home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 …ember: Reference Library / Dev.CD Dec 97 RL.toast / What's New / Tool Chest / Testing & Debugging / Virtual User / Examples / External Tool Templates / CPlus Tool Template / VU 2.1 Tool Template design < prev    next >
MacBinary  |  1997-10-15  |  82.6 KB  |  [ONLN/HLX2]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
100% file MacBinary II, inited, Tue Oct 8 08:00:00 1996, modified Wed Oct 15 06:59:14 1997, creator 'HLX2', type 'ONLN', 81719 bytes "VU 2.1 Tool Template design" , at 0x13fb7 2663 bytes resource default (weak)
99% file data default
100% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[ONLN]
macFileCreator[HLX2]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 1b 56 55 20 32 2e 31 | 20 54 6f 6f 6c 20 54 65 |..VU 2.1| Tool Te|
|00000010| 6d 70 6c 61 74 65 20 64 | 65 73 69 67 6e 00 00 00 |mplate d|esign...|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 4f 4e 4c 4e 48 4c 58 | 32 01 00 00 00 00 00 00 |.ONLNHLX|2.......|
|00000050| 00 00 00 00 01 3f 37 00 | 00 0a 67 ae 7f f2 c0 b0 |.....?7.|..g.....|
|00000060| 6a 52 82 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |jR......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 c8 dd 00 00 |........|........|
|00000080| f0 a8 09 4d 61 63 69 6e | 74 6f 73 68 a8 09 0d 5f |...Macin|tosh..._|
|00000090| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000000a0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000000b0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000000c0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000000d0| 09 09 09 09 09 0d 56 69 | 72 74 75 61 6c 20 55 73 |......Vi|rtual Us|
|000000e0| 65 72 20 32 2e 31 20 43 | 2b 2b 20 45 78 74 65 72 |er 2.1 C|++ Exter|
|000000f0| 6e 61 6c 20 54 6f 6f 6c | 20 54 65 6d 70 6c 61 74 |nal Tool| Templat|
|00000100| 65 20 0d 44 65 73 69 67 | 6e 20 4e 6f 74 65 73 0d |e .Desig|n Notes.|
|00000110| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000120| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000130| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000140| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000150| 5f 0d 09 09 0d 09 09 30 | 31 2f 31 30 2f 39 35 0d |_......0|1/10/95.|
|00000160| 09 09 0d 09 09 a9 20 41 | 70 70 6c 65 20 43 6f 6d |...... A|pple Com|
|00000170| 70 75 74 65 72 2c 20 49 | 6e 63 2e 20 31 39 39 34 |puter, I|nc. 1994|
|00000180| 0d 09 09 43 6f 6e 74 65 | 6e 74 73 0d 4f 76 65 72 |...Conte|nts.Over|
|00000190| 76 69 65 77 09 33 0d 43 | 68 61 70 74 65 72 20 31 |view.3.C|hapter 1|
|000001a0| 09 54 68 65 20 4e 6f 6e | 2d 54 68 72 65 61 64 65 |.The Non|-Threade|
|000001b0| 64 20 43 2b 2b 20 54 6f | 6f 6c 20 4d 6f 64 65 6c |d C++ To|ol Model|
|000001c0| 09 34 0d 4f 76 65 72 76 | 69 65 77 09 34 0d 4f 62 |.4.Overv|iew.4.Ob|
|000001d0| 6a 65 63 74 20 4f 62 6a | 65 63 74 09 35 0d 4c 69 |ject Obj|ect.5.Li|
|000001e0| 73 74 20 4f 62 6a 65 63 | 74 09 35 0d 41 70 70 6c |st Objec|t.5.Appl|
|000001f0| 69 63 61 74 69 6f 6e 20 | 4f 62 6a 65 63 74 09 35 |ication |Object.5|
|00000200| 0d 52 65 71 75 65 73 74 | 44 69 73 70 61 74 63 68 |.Request|Dispatch|
|00000210| 65 72 20 4f 62 6a 65 63 | 74 09 36 0d 53 65 72 76 |er Objec|t.6.Serv|
|00000220| 69 63 65 20 4f 62 6a 65 | 63 74 09 38 0d 52 65 71 |ice Obje|ct.8.Req|
|00000230| 75 65 73 74 20 4f 62 6a | 65 63 74 09 39 0d 41 45 |uest Obj|ect.9.AE|
|00000240| 52 65 71 75 65 73 74 20 | 4f 62 6a 65 63 74 09 39 |Request |Object.9|
|00000250| 0d 53 63 72 69 70 74 56 | 61 6c 75 65 20 4f 62 6a |.ScriptV|alue Obj|
|00000260| 65 63 74 09 31 30 0d 43 | 68 61 70 74 65 72 20 32 |ect.10.C|hapter 2|
|00000270| 09 41 64 64 69 6e 67 20 | 43 6f 6f 70 65 72 61 74 |.Adding |Cooperat|
|00000280| 69 76 65 20 54 68 72 65 | 61 64 73 09 31 31 0d 4f |ive Thre|ads.11.O|
|00000290| 76 65 72 76 69 65 77 09 | 31 31 0d 43 6f 6f 70 65 |verview.|11.Coope|
|000002a0| 72 61 74 69 76 65 20 54 | 68 72 65 61 64 65 64 20 |rative T|hreaded |
|000002b0| 4d 6f 64 65 6c 09 31 33 | 0d 41 70 70 6c 69 63 61 |Model.13|.Applica|
|000002c0| 74 69 6f 6e 20 54 68 72 | 65 61 64 09 31 34 0d 52 |tion Thr|ead.14.R|
|000002d0| 65 71 75 65 73 74 44 69 | 73 70 61 74 63 68 65 72 |equestDi|spatcher|
|000002e0| 20 54 68 72 65 61 64 09 | 31 36 0d 54 68 72 65 61 | Thread.|16.Threa|
|000002f0| 64 65 64 53 65 72 76 69 | 63 65 20 4f 62 6a 65 63 |dedServi|ce Objec|
|00000300| 74 09 31 37 0d 52 65 71 | 75 65 73 74 20 54 68 72 |t.17.Req|uest Thr|
|00000310| 65 61 64 09 31 38 0d 0d | 0d 4f 76 65 72 76 69 65 |ead.18..|.Overvie|
|00000320| 77 0d 54 68 69 73 20 64 | 6f 63 75 6d 65 6e 74 20 |w.This d|ocument |
|00000330| 63 6f 6e 74 61 69 6e 73 | 20 64 65 73 69 67 6e 20 |contains| design |
|00000340| 64 65 74 61 69 6c 73 20 | 66 6f 72 20 74 68 65 20 |details |for the |
|00000350| 56 55 20 32 2e 31 20 43 | 2b 2b 20 65 78 74 65 72 |VU 2.1 C|++ exter|
|00000360| 6e 61 6c 20 74 6f 6f 6c | 20 74 65 6d 70 6c 61 74 |nal tool| templat|
|00000370| 65 2e 20 20 54 68 65 20 | 66 69 72 73 74 20 63 68 |e. The |first ch|
|00000380| 61 70 74 65 72 20 64 69 | 73 63 75 73 73 65 73 20 |apter di|scusses |
|00000390| 74 68 65 20 62 61 73 69 | 63 20 6e 6f 6e 2d 74 68 |the basi|c non-th|
|000003a0| 72 65 61 64 65 64 20 6f | 70 65 72 61 74 69 6f 6e |readed o|peration|
|000003b0| 20 6f 66 20 74 68 65 20 | 74 65 6d 70 6c 61 74 65 | of the |template|
|000003c0| 2e 20 54 68 65 20 73 65 | 63 6f 6e 64 20 63 68 61 |. The se|cond cha|
|000003d0| 70 74 65 72 20 65 78 70 | 6c 61 69 6e 73 20 68 6f |pter exp|lains ho|
|000003e0| 77 20 74 68 72 65 61 64 | 65 64 20 73 65 72 76 69 |w thread|ed servi|
|000003f0| 63 65 73 20 61 72 65 20 | 69 6e 74 65 67 72 61 74 |ces are |integrat|
|00000400| 65 64 20 69 6e 74 6f 20 | 74 68 65 20 74 6f 6f 6c |ed into |the tool|
|00000410| 20 61 72 63 68 69 74 65 | 63 74 75 72 65 2e 0d 09 | archite|cture...|
|00000420| 43 68 61 70 74 65 72 20 | 31 09 54 68 65 20 4e 6f |Chapter |1.The No|
|00000430| 6e 2d 54 68 72 65 61 64 | 65 64 20 43 2b 2b 20 54 |n-Thread|ed C++ T|
|00000440| 6f 6f 6c 20 4d 6f 64 65 | 6c 0d 54 68 69 73 20 63 |ool Mode|l.This c|
|00000450| 68 61 70 74 65 72 20 64 | 65 73 63 72 69 62 65 73 |hapter d|escribes|
|00000460| 20 74 68 65 20 62 61 73 | 69 63 2c 20 6e 6f 6e 2d | the bas|ic, non-|
|00000470| 74 68 72 65 61 64 65 64 | 20 6f 70 65 72 61 74 69 |threaded| operati|
|00000480| 6f 6e 20 6f 66 20 74 68 | 65 20 56 55 20 32 2e 31 |on of th|e VU 2.1|
|00000490| 20 43 2b 2b 20 65 78 74 | 65 72 6e 61 6c 20 74 6f | C++ ext|ernal to|
|000004a0| 6f 6c 20 74 65 6d 70 6c | 61 74 65 2e 20 49 74 20 |ol templ|ate. It |
|000004b0| 69 73 20 65 78 74 65 72 | 6e 61 6c 6c 79 20 76 65 |is exter|nally ve|
|000004c0| 72 79 20 73 69 6d 69 6c | 61 72 20 74 6f 20 74 68 |ry simil|ar to th|
|000004d0| 65 20 56 55 20 32 2e 30 | 20 74 65 6d 70 6c 61 74 |e VU 2.0| templat|
|000004e0| 65 20 77 69 74 68 20 73 | 6f 6d 65 20 6d 69 6e 6f |e with s|ome mino|
|000004f0| 72 20 63 68 61 6e 67 65 | 73 20 74 6f 20 61 73 73 |r change|s to ass|
|00000500| 69 73 74 20 69 6e 20 69 | 6d 70 6c 65 6d 65 6e 74 |ist in i|mplement|
|00000510| 69 6e 67 20 74 68 72 65 | 61 64 73 2e 0d 42 65 66 |ing thre|ads..Bef|
|00000520| 6f 72 65 20 72 65 61 64 | 69 6e 67 20 74 68 69 73 |ore read|ing this|
|00000530| 20 63 68 61 70 74 65 72 | 2c 20 79 6f 75 20 73 68 | chapter|, you sh|
|00000540| 6f 75 6c 64 20 62 65 20 | 66 61 6d 69 6c 69 61 72 |ould be |familiar|
|00000550| 20 77 69 74 68 20 74 68 | 65 20 73 74 72 75 63 74 | with th|e struct|
|00000560| 75 72 65 20 61 6e 64 20 | 70 72 6f 74 6f 63 6f 6c |ure and |protocol|
|00000570| 20 6f 66 20 41 70 70 6c | 65 20 65 76 65 6e 74 73 | of Appl|e events|
|00000580| 2c 20 64 65 73 63 72 69 | 62 65 64 20 69 6e 20 74 |, descri|bed in t|
|00000590| 68 65 20 76 6f 6c 75 6d | 65 20 22 49 6e 73 69 64 |he volum|e "Insid|
|000005a0| 65 20 4d 61 63 69 6e 74 | 6f 73 68 20 49 6e 74 65 |e Macint|osh Inte|
|000005b0| 72 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 43 6f 6d |rapplica|tion Com|
|000005c0| 6d 75 6e 69 63 61 74 69 | 6f 6e 2e 22 20 59 6f 75 |municati|on." You|
|000005d0| 20 73 68 6f 75 6c 64 20 | 72 65 61 64 20 74 68 65 | should |read the|
|000005e0| 20 74 77 6f 20 63 68 61 | 70 74 65 72 73 20 69 6e | two cha|pters in|
|000005f0| 20 74 68 65 20 56 69 72 | 74 75 61 6c 20 55 73 65 | the Vir|tual Use|
|00000600| 72 20 4c 61 6e 67 75 61 | 67 65 20 52 65 66 65 72 |r Langua|ge Refer|
|00000610| 65 6e 63 65 20 66 6f 72 | 20 56 69 72 74 75 61 6c |ence for| Virtual|
|00000620| 20 55 73 65 72 20 32 2e | 30 20 65 6e 74 69 74 6c | User 2.|0 entitl|
|00000630| 65 64 20 22 55 73 69 6e | 67 20 45 78 74 65 72 6e |ed "Usin|g Extern|
|00000640| 61 6c 20 54 6f 6f 6c 73 | 22 20 61 6e 64 20 22 57 |al Tools|" and "W|
|00000650| 72 69 74 69 6e 67 20 45 | 78 74 65 72 6e 61 6c 20 |riting E|xternal |
|00000660| 54 6f 6f 6c 73 22 2c 20 | 61 6e 64 20 61 6e 79 20 |Tools", |and any |
|00000670| 61 64 64 65 6e 64 75 6d | 27 73 20 66 6f 72 20 65 |addendum|'s for e|
|00000680| 78 74 65 72 6e 61 6c 20 | 74 6f 6f 6c 73 20 69 6e |xternal |tools in|
|00000690| 20 74 68 65 20 56 55 20 | 32 2e 31 20 64 6f 63 75 | the VU |2.1 docu|
|000006a0| 6d 65 6e 74 61 74 69 6f | 6e 2e 0d 4f 76 65 72 76 |mentatio|n..Overv|
|000006b0| 69 65 77 0d 09 41 6c 6c | 20 6f 62 6a 65 63 74 73 |iew..All| objects|
|000006c0| 20 69 6e 20 74 68 65 20 | 74 65 6d 70 6c 61 74 65 | in the |template|
|000006d0| 20 61 72 65 20 64 65 72 | 69 76 65 64 20 66 72 6f | are der|ived fro|
|000006e0| 6d 20 74 77 6f 20 61 75 | 78 69 6c 69 61 72 79 20 |m two au|xiliary |
|000006f0| 63 6c 61 73 73 65 73 3a | 0d 4f 62 6a 65 63 74 20 |classes:|.Object |
|00000700| 54 79 70 65 09 46 75 6e | 63 74 69 6f 6e 0d 4f 62 |Type.Fun|ction.Ob|
|00000710| 6a 65 63 74 09 65 76 65 | 72 79 74 68 69 6e 67 20 |ject.eve|rything |
|00000720| 69 73 20 61 6e 20 4f 62 | 6a 65 63 74 3b 20 61 20 |is an Ob|ject; a |
|00000730| 63 6f 6d 70 6f 6e 65 6e | 74 20 6f 66 20 4c 69 73 |componen|t of Lis|
|00000740| 74 73 0d 4c 69 73 74 09 | 63 6f 6e 74 61 69 6e 73 |ts.List.|contains|
|00000750| 20 76 61 72 69 6f 75 73 | 20 4f 62 6a 65 63 74 73 | various| Objects|
|00000760| 3b 20 70 72 6f 76 69 64 | 65 73 20 63 6f 6d 6d 6f |; provid|es commo|
|00000770| 6e 20 66 75 6e 63 74 69 | 6f 6e 73 20 66 6f 72 20 |n functi|ons for |
|00000780| 6c 69 73 74 20 6d 61 6e | 69 70 75 6c 61 74 69 6f |list man|ipulatio|
|00000790| 6e 3b 20 75 73 65 64 20 | 66 6f 72 20 71 75 65 75 |n; used |for queu|
|000007a0| 65 73 20 69 6e 20 74 68 | 65 20 74 65 6d 70 6c 61 |es in th|e templa|
|000007b0| 74 65 0d 09 54 68 65 20 | 74 65 6d 70 6c 61 74 65 |te..The |template|
|000007c0| 20 75 73 65 73 20 73 65 | 76 65 72 61 6c 20 6b 65 | uses se|veral ke|
|000007d0| 79 20 6f 62 6a 65 63 74 | 20 74 79 70 65 73 20 64 |y object| types d|
|000007e0| 75 72 69 6e 67 20 6e 6f | 72 6d 61 6c 20 6f 70 65 |uring no|rmal ope|
|000007f0| 72 61 74 69 6f 6e 3a 0d | 4f 62 6a 65 63 74 20 54 |ration:.|Object T|
|00000800| 79 70 65 09 46 75 6e 63 | 74 69 6f 6e 0d 41 70 70 |ype.Func|tion.App|
|00000810| 6c 69 63 61 74 69 6f 6e | 09 63 6f 6e 74 61 69 6e |lication|.contain|
|00000820| 73 20 74 68 65 20 65 76 | 65 6e 74 20 6c 6f 6f 70 |s the ev|ent loop|
|00000830| 3b 20 69 6e 73 74 61 6c | 6c 73 20 64 65 66 61 75 |; instal|ls defau|
|00000840| 6c 74 20 61 6e 64 20 56 | 55 20 73 65 72 76 69 63 |lt and V|U servic|
|00000850| 65 20 72 65 71 75 65 73 | 74 20 41 70 70 6c 65 20 |e reques|t Apple |
|00000860| 65 76 65 6e 74 20 68 61 | 6e 64 6c 65 72 73 3b 20 |event ha|ndlers; |
|00000870| 63 72 65 61 74 65 73 20 | 74 68 65 20 52 65 71 75 |creates |the Requ|
|00000880| 65 73 74 44 69 73 70 61 | 74 63 68 65 72 3b 20 70 |estDispa|tcher; p|
|00000890| 75 74 73 20 41 45 52 65 | 71 75 65 73 74 20 6f 62 |uts AERe|quest ob|
|000008a0| 6a 65 63 74 73 20 69 6e | 74 6f 20 74 68 65 20 71 |jects in|to the q|
|000008b0| 75 65 75 65 3b 20 67 69 | 76 65 73 20 74 69 6d 65 |ueue; gi|ves time|
|000008c0| 20 74 6f 20 74 68 65 20 | 52 65 71 75 65 73 74 44 | to the |RequestD|
|000008d0| 69 73 70 61 74 63 68 65 | 72 3b 0d 52 65 71 75 65 |ispatche|r;.Reque|
|000008e0| 73 74 44 69 73 70 61 74 | 63 68 65 72 09 63 72 65 |stDispat|cher.cre|
|000008f0| 61 74 65 73 20 61 20 6c | 69 73 74 20 6f 66 20 53 |ates a l|ist of S|
|00000900| 65 72 76 69 63 65 20 6f | 62 6a 65 63 74 73 3b 20 |ervice o|bjects; |
|00000910| 64 69 73 70 61 74 63 68 | 65 73 20 41 45 52 65 71 |dispatch|es AEReq|
|00000920| 75 65 73 74 73 20 66 72 | 6f 6d 20 74 68 65 20 71 |uests fr|om the q|
|00000930| 75 65 75 65 3b 20 6d 61 | 6e 61 67 65 73 20 65 78 |ueue; ma|nages ex|
|00000940| 65 63 75 74 69 6f 6e 20 | 61 6e 64 20 74 65 72 6d |ecution |and term|
|00000950| 69 6e 61 74 69 6f 6e 20 | 6f 66 20 61 63 74 69 76 |ination |of activ|
|00000960| 65 20 73 65 72 76 69 63 | 65 20 72 65 71 75 65 73 |e servic|e reques|
|00000970| 74 73 3b 0d 53 65 72 76 | 69 63 65 09 63 6f 72 72 |ts;.Serv|ice.corr|
|00000980| 65 73 70 6f 6e 64 73 20 | 74 6f 20 61 20 56 55 20 |esponds |to a VU |
|00000990| 45 78 74 65 72 6e 61 6c | 20 54 6f 6f 6c 20 53 65 |External| Tool Se|
|000009a0| 72 76 69 63 65 3b 20 63 | 6f 6e 74 61 69 6e 73 20 |rvice; c|ontains |
|000009b0| 74 68 65 20 73 74 72 69 | 6e 67 20 6e 61 6d 65 20 |the stri|ng name |
|000009c0| 61 6e 64 20 74 68 65 20 | 61 63 74 75 61 6c 20 63 |and the |actual c|
|000009d0| 6f 64 65 20 74 6f 20 70 | 72 6f 63 65 73 73 20 74 |ode to p|rocess t|
|000009e0| 68 65 20 72 65 71 75 65 | 73 74 3b 0d 52 65 71 75 |he reque|st;.Requ|
|000009f0| 65 73 74 09 72 65 70 72 | 65 73 65 6e 74 73 20 61 |est.repr|esents a|
|00000a00| 20 73 69 6e 67 6c 65 20 | 73 65 72 76 69 63 65 20 | single |service |
|00000a10| 63 61 6c 6c 20 66 72 6f | 6d 20 61 20 72 75 6e 6e |call fro|m a runn|
|00000a20| 69 6e 67 20 73 63 72 69 | 70 74 3b 20 63 6f 6e 74 |ing scri|pt; cont|
|00000a30| 61 69 6e 73 20 6d 65 6d | 62 65 72 73 20 61 6e 64 |ains mem|bers and|
|00000a40| 20 66 75 6e 63 74 69 6f | 6e 73 20 66 6f 72 20 75 | functio|ns for u|
|00000a50| 73 65 20 62 79 20 74 68 | 65 20 52 65 71 75 65 73 |se by th|e Reques|
|00000a60| 74 44 69 73 70 61 74 63 | 68 65 72 20 61 6e 64 20 |tDispatc|her and |
|00000a70| 53 65 72 76 69 63 65 20 | 6f 62 6a 65 63 74 73 3b |Service |objects;|
|00000a80| 0d 41 45 52 65 71 75 65 | 73 74 09 63 68 69 6c 64 |.AEReque|st.child|
|00000a90| 20 63 6c 61 73 73 20 6f | 66 20 52 65 71 75 65 73 | class o|f Reques|
|00000aa0| 74 3b 20 72 65 70 72 65 | 73 65 6e 74 73 20 74 68 |t; repre|sents th|
|00000ab0| 65 20 41 70 70 6c 65 20 | 65 76 65 6e 74 20 74 68 |e Apple |event th|
|00000ac0| 61 74 20 63 6f 6e 76 65 | 79 73 20 74 68 65 20 73 |at conve|ys the s|
|00000ad0| 65 72 76 69 63 65 20 72 | 65 71 75 65 73 74 3b 20 |ervice r|equest; |
|00000ae0| 63 6f 6e 74 61 69 6e 73 | 20 6d 65 6d 62 65 72 73 |contains| members|
|00000af0| 20 61 6e 64 20 66 75 6e | 63 74 69 6f 6e 73 20 66 | and fun|ctions f|
|00000b00| 6f 72 20 75 73 65 20 62 | 79 20 74 68 65 20 41 70 |or use b|y the Ap|
|00000b10| 70 6c 65 20 45 76 65 6e | 74 20 4d 61 6e 61 67 65 |ple Even|t Manage|
|00000b20| 72 3b 0d 53 63 72 69 70 | 74 56 61 6c 75 65 09 72 |r;.Scrip|tValue.r|
|00000b30| 65 70 72 65 73 65 6e 74 | 73 20 76 61 6c 75 65 73 |epresent|s values|
|00000b40| 20 69 6e 20 61 20 73 69 | 6d 69 6c 61 72 20 77 61 | in a si|milar wa|
|00000b50| 79 20 74 6f 20 56 55 27 | 73 20 76 61 6c 75 65 20 |y to VU'|s value |
|00000b60| 74 79 70 65 73 3b 20 75 | 73 65 64 20 74 6f 20 65 |types; u|sed to e|
|00000b70| 78 74 72 61 63 74 20 70 | 61 72 61 6d 65 74 65 72 |xtract p|arameter|
|00000b80| 73 20 6f 75 74 20 6f 66 | 20 52 65 71 75 65 73 74 |s out of| Request|
|00000b90| 20 6f 62 6a 65 63 74 73 | 3b 20 69 6e 63 6c 75 64 | objects|; includ|
|00000ba0| 65 73 20 61 20 6c 69 73 | 74 20 74 79 70 65 3b 0d |es a lis|t type;.|
|00000bb0| 4f 62 6a 65 63 74 20 4f | 62 6a 65 63 74 0d 09 54 |Object O|bject..T|
|00000bc0| 68 69 73 20 69 73 20 61 | 20 64 75 6d 6d 79 20 63 |his is a| dummy c|
|00000bd0| 6c 61 73 73 20 77 69 74 | 68 20 6e 6f 20 6d 65 6d |lass wit|h no mem|
|00000be0| 62 65 72 73 20 6f 72 20 | 66 75 6e 63 74 69 6f 6e |bers or |function|
|00000bf0| 73 2e 20 49 74 73 20 6f | 6e 6c 79 20 70 75 72 70 |s. Its o|nly purp|
|00000c00| 6f 73 65 20 69 73 20 73 | 6f 20 74 68 65 20 4c 69 |ose is s|o the Li|
|00000c10| 73 74 20 6f 62 6a 65 63 | 74 20 63 61 6e 20 6d 61 |st objec|t can ma|
|00000c20| 6e 69 70 75 6c 61 74 65 | 20 67 65 6e 65 72 69 63 |nipulate| generic|
|00000c30| 20 6f 62 6a 65 63 74 73 | 20 69 6e 20 6c 69 73 74 | objects| in list|
|00000c40| 73 20 77 69 74 68 6f 75 | 74 20 61 6e 79 20 6b 6e |s withou|t any kn|
|00000c50| 6f 77 6c 65 64 67 65 20 | 6f 66 20 74 68 65 69 72 |owledge |of their|
|00000c60| 20 63 6c 61 73 73 2e 20 | 49 74 20 70 72 6f 76 69 | class. |It provi|
|00000c70| 64 65 73 20 61 20 76 69 | 72 74 75 61 6c 20 64 65 |des a vi|rtual de|
|00000c80| 73 74 72 75 63 74 69 6f | 6e 20 73 6f 20 74 68 65 |structio|n so the|
|00000c90| 20 4c 69 73 74 20 44 69 | 73 70 6f 73 65 41 6c 6c | List Di|sposeAll|
|00000ca0| 28 29 20 66 75 6e 63 74 | 69 6f 6e 20 64 6f 65 73 |() funct|ion does|
|00000cb0| 20 6e 6f 74 20 68 61 76 | 65 20 74 6f 20 6b 6e 6f | not hav|e to kno|
|00000cc0| 77 20 77 68 61 74 20 69 | 74 20 69 73 20 64 65 6c |w what i|t is del|
|00000cd0| 65 74 69 6e 67 2e 20 41 | 6c 6c 20 6f 62 6a 65 63 |eting. A|ll objec|
|00000ce0| 74 73 20 64 65 66 69 6e | 65 64 20 62 79 20 74 68 |ts defin|ed by th|
|00000cf0| 65 20 74 6f 6f 6c 20 74 | 65 6d 70 6c 61 74 65 20 |e tool t|emplate |
|00000d00| 73 68 6f 75 6c 64 20 62 | 65 20 64 65 72 69 76 65 |should b|e derive|
|00000d10| 64 20 66 72 6f 6d 20 74 | 68 65 20 4f 62 6a 65 63 |d from t|he Objec|
|00000d20| 74 20 63 6c 61 73 73 2e | 0d 09 0d 4c 69 73 74 20 |t class.|...List |
|00000d30| 4f 62 6a 65 63 74 0d 09 | 54 68 65 20 4c 69 73 74 |Object..|The List|
|00000d40| 20 6f 62 6a 65 63 74 20 | 70 72 6f 76 69 64 65 73 | object |provides|
|00000d50| 20 6d 61 6e 79 20 75 73 | 65 66 75 6c 20 66 75 6e | many us|eful fun|
|00000d60| 63 74 69 6f 6e 73 20 66 | 6f 72 20 77 6f 72 6b 69 |ctions f|or worki|
|00000d70| 6e 67 20 77 69 74 68 20 | 6c 69 73 74 73 20 6f 66 |ng with |lists of|
|00000d80| 20 6f 62 6a 65 63 74 73 | 20 6f 66 20 61 72 62 69 | objects| of arbi|
|00000d90| 74 72 61 72 79 20 63 6c | 61 73 73 2c 20 61 73 20 |trary cl|ass, as |
|00000da0| 6c 6f 6e 67 20 61 73 20 | 74 68 65 79 20 61 72 65 |long as |they are|
|00000db0| 20 64 65 72 69 76 65 64 | 20 66 72 6f 6d 20 74 68 | derived| from th|
|00000dc0| 65 20 62 61 73 65 20 63 | 6c 61 73 73 20 4f 62 6a |e base c|lass Obj|
|00000dd0| 65 63 74 2e 20 54 68 65 | 20 6c 69 73 74 20 6f 66 |ect. The| list of|
|00000de0| 20 53 65 72 76 69 63 65 | 73 2c 20 74 68 65 20 70 | Service|s, the p|
|00000df0| 65 6e 64 69 6e 67 20 72 | 65 71 75 65 73 74 20 71 |ending r|equest q|
|00000e00| 75 65 75 65 20 61 6e 64 | 20 74 68 65 20 61 63 74 |ueue and| the act|
|00000e10| 69 76 65 20 72 65 71 75 | 65 73 74 20 6c 69 73 74 |ive requ|est list|
|00000e20| 20 61 72 65 20 4c 69 73 | 74 73 2e 20 54 68 65 20 | are Lis|ts. The |
|00000e30| 4c 6f 6f 70 20 6f 62 6a | 65 63 74 20 69 73 20 64 |Loop obj|ect is d|
|00000e40| 65 66 69 6e 65 64 20 69 | 6e 20 74 68 65 20 73 61 |efined i|n the sa|
|00000e50| 6d 65 20 66 69 6c 65 20 | 61 73 20 4c 69 73 74 73 |me file |as Lists|
|00000e60| 2e 20 4c 6f 6f 70 20 6f | 62 6a 65 63 74 73 20 6d |. Loop o|bjects m|
|00000e70| 61 6b 65 20 69 74 20 65 | 61 73 69 65 72 20 74 6f |ake it e|asier to|
|00000e80| 20 69 74 65 72 61 74 65 | 20 74 68 72 6f 75 67 68 | iterate| through|
|00000e90| 20 61 6c 6c 20 74 68 65 | 20 69 74 65 6d 73 20 69 | all the| items i|
|00000ea0| 6e 20 61 20 6c 69 73 74 | 20 62 65 63 61 75 73 65 |n a list| because|
|00000eb0| 20 74 68 65 20 63 6f 75 | 6e 74 65 72 20 69 73 20 | the cou|nter is |
|00000ec0| 65 6d 62 65 64 64 65 64 | 20 69 6e 20 74 68 65 20 |embedded| in the |
|00000ed0| 6f 62 6a 65 63 74 2e 0d | 09 0d 41 70 70 6c 69 63 |object..|..Applic|
|00000ee0| 61 74 69 6f 6e 20 4f 62 | 6a 65 63 74 0d 09 54 68 |ation Ob|ject..Th|
|00000ef0| 65 20 41 70 70 6c 69 63 | 61 74 69 6f 6e 20 6f 62 |e Applic|ation ob|
|00000f00| 6a 65 63 74 20 69 73 20 | 74 68 65 20 69 6e 74 65 |ject is |the inte|
|00000f10| 72 66 61 63 65 20 62 65 | 74 77 65 65 6e 20 74 68 |rface be|tween th|
|00000f20| 65 20 74 6f 6f 6c 20 74 | 65 6d 70 6c 61 74 65 20 |e tool t|emplate |
|00000f30| 61 6e 64 20 74 68 65 20 | 77 6f 72 6c 64 20 6f 75 |and the |world ou|
|00000f40| 74 73 69 64 65 2c 20 61 | 6e 64 20 74 68 65 20 6f |tside, a|nd the o|
|00000f50| 77 6e 65 72 20 6f 66 20 | 74 68 65 20 50 72 6f 63 |wner of |the Proc|
|00000f60| 65 73 73 20 73 70 61 63 | 65 2e 20 45 76 65 6e 20 |ess spac|e. Even |
|00000f70| 74 68 6f 75 67 68 20 74 | 68 65 20 6d 61 69 6e 28 |though t|he main(|
|00000f80| 29 20 72 6f 75 74 69 6e | 65 20 63 72 65 61 74 65 |) routin|e create|
|00000f90| 73 20 61 6e 64 20 6f 77 | 6e 73 20 74 68 65 20 41 |s and ow|ns the A|
|00000fa0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 6f 62 6a 65 63 |pplicati|on objec|
|00000fb0| 74 2c 20 61 6c 6c 20 69 | 6d 70 6f 72 74 61 6e 74 |t, all i|mportant|
|00000fc0| 20 61 63 74 69 76 69 74 | 79 20 69 6e 20 74 68 65 | activit|y in the|
|00000fd0| 20 74 6f 6f 6c 2c 20 66 | 72 6f 6d 20 69 6e 69 74 | tool, f|rom init|
|00000fe0| 69 61 6c 69 7a 61 74 69 | 6f 6e 20 74 6f 20 71 75 |ializati|on to qu|
|00000ff0| 69 74 2c 20 74 72 61 63 | 65 73 20 62 61 63 6b 20 |it, trac|es back |
|00001000| 74 6f 20 61 20 63 61 6c | 6c 20 69 6e 20 74 68 65 |to a cal|l in the|
|00001010| 20 41 70 70 6c 69 63 61 | 74 69 6f 6e 20 6f 62 6a | Applica|tion obj|
|00001020| 65 63 74 2e 20 57 68 65 | 6e 20 74 68 65 20 74 6f |ect. Whe|n the to|
|00001030| 6f 6c 20 69 73 20 6c 61 | 75 6e 63 68 65 64 2c 20 |ol is la|unched, |
|00001040| 74 68 65 20 6d 61 69 6e | 28 29 20 72 6f 75 74 69 |the main|() routi|
|00001050| 6e 65 20 63 72 65 61 74 | 65 73 20 61 20 6e 65 77 |ne creat|es a new|
|00001060| 20 41 70 70 6c 69 63 61 | 74 69 6f 6e 20 61 6e 64 | Applica|tion and|
|00001070| 20 69 6d 6d 65 64 69 61 | 74 65 6c 79 20 63 61 6c | immedia|tely cal|
|00001080| 6c 73 20 69 74 73 20 52 | 75 6e 28 29 20 66 75 6e |ls its R|un() fun|
|00001090| 63 74 69 6f 6e 2e 20 57 | 68 65 6e 20 74 68 65 20 |ction. W|hen the |
|000010a0| 52 75 6e 28 29 20 66 75 | 6e 63 74 69 6f 6e 20 72 |Run() fu|nction r|
|000010b0| 65 74 75 72 6e 73 2c 20 | 74 68 65 20 6d 61 69 6e |eturns, |the main|
|000010c0| 28 29 20 72 6f 75 74 69 | 6e 65 20 64 69 73 70 6f |() routi|ne dispo|
|000010d0| 73 65 73 20 74 68 65 20 | 41 70 70 6c 69 63 61 74 |ses the |Applicat|
|000010e0| 69 6f 6e 20 61 6e 64 20 | 72 65 74 75 72 6e 73 2e |ion and |returns.|
|000010f0| 0d 09 54 68 65 20 41 70 | 70 6c 69 63 61 74 69 6f |..The Ap|plicatio|
|00001100| 6e 20 63 6f 6e 73 74 72 | 75 63 74 6f 72 20 69 6e |n constr|uctor in|
|00001110| 69 74 69 61 6c 69 7a 65 | 73 20 74 68 65 20 54 6f |itialize|s the To|
|00001120| 6f 6c 62 6f 78 2c 20 65 | 6e 73 75 72 65 73 20 74 |olbox, e|nsures t|
|00001130| 68 65 20 6d 69 6e 69 6d | 75 6d 20 73 79 73 74 65 |he minim|um syste|
|00001140| 6d 20 72 65 71 75 69 72 | 65 6d 65 6e 74 73 20 61 |m requir|ements a|
|00001150| 72 65 20 6d 65 74 2c 20 | 73 65 74 73 20 76 61 72 |re met, |sets var|
|00001160| 69 6f 75 73 20 63 6f 6e | 66 69 67 75 72 61 74 69 |ious con|figurati|
|00001170| 6f 6e 20 66 6c 61 67 73 | 2c 20 69 6e 73 74 61 6c |on flags|, instal|
|00001180| 6c 73 20 61 6c 6c 20 74 | 68 65 20 41 70 70 6c 65 |ls all t|he Apple|
|00001190| 20 65 76 65 6e 74 20 68 | 61 6e 64 6c 65 72 73 2c | event h|andlers,|
|000011a0| 20 61 6e 64 20 63 72 65 | 61 74 65 73 20 74 68 65 | and cre|ates the|
|000011b0| 20 52 65 71 75 65 73 74 | 44 69 73 70 61 74 63 68 | Request|Dispatch|
|000011c0| 65 72 20 6f 62 6a 65 63 | 74 2e 20 4f 6e 6c 79 20 |er objec|t. Only |
|000011d0| 6f 6e 65 20 52 65 71 75 | 65 73 74 44 69 73 70 61 |one Requ|estDispa|
|000011e0| 74 63 68 65 72 20 69 73 | 20 65 76 65 72 20 63 72 |tcher is| ever cr|
|000011f0| 65 61 74 65 64 20 62 79 | 20 61 6e 20 41 70 70 6c |eated by| an Appl|
|00001200| 69 63 61 74 69 6f 6e 2c | 20 61 6e 64 20 61 20 70 |ication,| and a p|
|00001210| 6f 69 6e 74 65 72 20 74 | 6f 20 69 74 20 69 73 20 |ointer t|o it is |
|00001220| 73 74 6f 72 65 64 20 69 | 6e 20 61 20 67 6c 6f 62 |stored i|n a glob|
|00001230| 61 6c 20 76 61 72 69 61 | 62 6c 65 2e 20 49 66 20 |al varia|ble. If |
|00001240| 61 6e 79 20 6f 66 20 74 | 68 69 73 20 66 61 69 6c |any of t|his fail|
|00001250| 73 2c 20 74 68 65 20 75 | 73 65 72 20 69 73 20 6e |s, the u|ser is n|
|00001260| 6f 74 69 66 69 65 64 20 | 74 68 72 6f 75 67 68 20 |otified |through |
|00001270| 74 68 65 20 54 65 72 6d | 69 6e 61 6c 45 72 72 6f |the Term|inalErro|
|00001280| 72 28 29 20 66 75 6e 63 | 74 69 6f 6e 2c 20 77 68 |r() func|tion, wh|
|00001290| 69 63 68 20 69 73 20 6e | 6f 74 20 61 20 6d 65 6d |ich is n|ot a mem|
|000012a0| 62 65 72 20 66 75 6e 63 | 74 69 6f 6e 20 6f 66 20 |ber func|tion of |
|000012b0| 61 6e 79 20 6f 62 6a 65 | 63 74 2e 20 46 69 72 73 |any obje|ct. Firs|
|000012c0| 74 2c 20 69 74 20 64 69 | 73 70 6c 61 79 73 20 61 |t, it di|splays a|
|000012d0| 6e 20 61 6c 65 72 74 20 | 77 69 74 68 20 61 20 67 |n alert |with a g|
|000012e0| 69 76 65 6e 20 73 74 72 | 69 6e 67 2e 20 57 68 65 |iven str|ing. Whe|
|000012f0| 6e 20 74 68 65 20 75 73 | 65 72 20 61 63 6b 6e 6f |n the us|er ackno|
|00001300| 77 6c 65 64 67 65 73 20 | 74 68 65 20 61 6c 65 72 |wledges |the aler|
|00001310| 74 2c 20 54 65 72 6d 69 | 6e 61 6c 45 72 72 6f 72 |t, Termi|nalError|
|00001320| 28 29 20 64 65 6c 65 74 | 65 73 20 74 68 65 20 41 |() delet|es the A|
|00001330| 70 70 6c 69 63 61 74 69 | 6f 6e 20 6f 62 6a 65 63 |pplicati|on objec|
|00001340| 74 20 61 6e 64 20 63 61 | 6c 6c 73 20 45 78 69 74 |t and ca|lls Exit|
|00001350| 54 6f 53 68 65 6c 6c 28 | 29 2e 0d 09 49 66 20 74 |ToShell(|)...If t|
|00001360| 68 65 20 41 70 70 6c 69 | 63 61 74 69 6f 6e 20 61 |he Appli|cation a|
|00001370| 6e 64 20 52 65 71 75 65 | 73 74 44 69 73 70 61 74 |nd Reque|stDispat|
|00001380| 63 68 65 72 20 69 6e 69 | 74 69 61 6c 69 7a 61 74 |cher ini|tializat|
|00001390| 69 6f 6e 73 20 73 75 63 | 63 65 65 64 2c 20 74 68 |ions suc|ceed, th|
|000013a0| 65 20 63 6f 6e 73 74 72 | 75 63 74 6f 72 20 72 65 |e constr|uctor re|
|000013b0| 74 75 72 6e 73 2c 20 61 | 6e 64 20 74 68 65 20 6d |turns, a|nd the m|
|000013c0| 61 69 6e 28 29 20 72 6f | 75 74 69 6e 65 20 63 61 |ain() ro|utine ca|
|000013d0| 6c 6c 73 20 74 68 65 20 | 41 70 70 6c 69 63 61 74 |lls the |Applicat|
|000013e0| 69 6f 6e 20 52 75 6e 28 | 29 20 66 75 6e 63 74 69 |ion Run(|) functi|
|000013f0| 6f 6e 2e 20 54 68 65 20 | 52 75 6e 28 29 20 66 75 |on. The |Run() fu|
|00001400| 6e 63 74 69 6f 6e 20 69 | 73 20 61 20 73 68 6f 72 |nction i|s a shor|
|00001410| 74 20 6c 6f 6f 70 20 74 | 68 61 74 20 61 6c 74 65 |t loop t|hat alte|
|00001420| 72 6e 61 74 65 6c 79 20 | 63 61 6c 6c 73 20 74 68 |rnately |calls th|
|00001430| 65 20 41 70 70 6c 69 63 | 61 74 69 6f 6e 20 44 6f |e Applic|ation Do|
|00001440| 45 76 65 6e 74 28 29 20 | 66 75 6e 63 74 69 6f 6e |Event() |function|
|00001450| 2c 20 74 68 65 6e 20 74 | 68 65 20 52 65 71 75 65 |, then t|he Reque|
|00001460| 73 74 44 69 73 70 61 74 | 63 68 65 72 20 44 6f 52 |stDispat|cher DoR|
|00001470| 65 71 75 65 73 74 73 28 | 29 20 66 75 6e 63 74 69 |equests(|) functi|
|00001480| 6f 6e 2e 0d 09 44 6f 45 | 76 65 6e 74 28 29 20 63 |on...DoE|vent() c|
|00001490| 61 6c 6c 73 20 57 61 69 | 74 4e 65 78 74 45 76 65 |alls Wai|tNextEve|
|000014a0| 6e 74 28 29 20 77 69 74 | 68 20 74 68 65 20 61 70 |nt() wit|h the ap|
|000014b0| 70 72 6f 70 72 69 61 74 | 65 20 74 69 6d 65 20 74 |propriat|e time t|
|000014c0| 6f 20 77 61 69 74 2c 20 | 64 65 70 65 6e 64 69 6e |o wait, |dependin|
|000014d0| 67 20 6f 6e 20 77 68 65 | 74 68 65 72 20 74 68 65 |g on whe|ther the|
|000014e0| 20 74 6f 6f 6c 20 69 73 | 20 69 6e 20 74 68 65 20 | tool is| in the |
|000014f0| 66 6f 72 65 67 72 6f 75 | 6e 64 20 6f 72 20 62 61 |foregrou|nd or ba|
|00001500| 63 6b 67 72 6f 75 6e 64 | 2e 20 44 6f 45 76 65 6e |ckground|. DoEven|
|00001510| 74 28 29 20 68 61 73 20 | 61 20 63 61 73 65 20 73 |t() has |a case s|
|00001520| 74 61 74 65 6d 65 6e 74 | 20 74 6f 20 68 61 6e 64 |tatement| to hand|
|00001530| 6c 65 20 64 69 66 66 65 | 72 65 6e 74 20 74 79 70 |le diffe|rent typ|
|00001540| 65 73 20 6f 66 20 65 76 | 65 6e 74 73 2e 0d 09 57 |es of ev|ents...W|
|00001550| 68 65 6e 20 61 20 73 63 | 72 69 70 74 20 6d 61 6b |hen a sc|ript mak|
|00001560| 65 73 20 61 20 73 65 72 | 76 69 63 65 20 63 61 6c |es a ser|vice cal|
|00001570| 6c 20 74 6f 20 74 68 65 | 20 74 6f 6f 6c 2c 20 44 |l to the| tool, D|
|00001580| 6f 45 76 65 6e 74 28 29 | 20 72 65 63 65 69 76 65 |oEvent()| receive|
|00001590| 73 20 61 20 68 69 67 68 | 2d 6c 65 76 65 6c 20 65 |s a high|-level e|
|000015a0| 76 65 6e 74 20 61 6e 64 | 20 70 61 73 73 65 73 20 |vent and| passes |
|000015b0| 69 74 20 74 6f 20 41 45 | 50 72 6f 63 65 73 73 41 |it to AE|ProcessA|
|000015c0| 70 70 6c 65 45 76 65 6e | 74 28 29 2e 20 49 74 20 |ppleEven|t(). It |
|000015d0| 74 75 72 6e 73 20 6f 75 | 74 20 74 6f 20 62 65 20 |turns ou|t to be |
|000015e0| 61 6e 20 41 70 70 6c 65 | 20 65 76 65 6e 74 20 6f |an Apple| event o|
|000015f0| 66 20 63 6c 61 73 73 20 | 27 76 2e 75 2e 27 20 61 |f class |'v.u.' a|
|00001600| 6e 64 20 69 64 20 27 65 | 78 74 63 27 20 63 6f 6e |nd id 'e|xtc' con|
|00001610| 74 61 69 6e 69 6e 67 20 | 74 68 65 20 73 65 72 76 |taining |the serv|
|00001620| 69 63 65 20 6e 61 6d 65 | 20 61 6e 64 20 70 61 72 |ice name| and par|
|00001630| 61 6d 65 74 65 72 73 2e | 20 54 68 65 20 68 61 6e |ameters.| The han|
|00001640| 64 6c 65 72 20 66 6f 72 | 20 56 55 20 73 65 72 76 |dler for| VU serv|
|00001650| 69 63 65 20 63 61 6c 6c | 73 20 63 6f 70 69 65 73 |ice call|s copies|
|00001660| 20 74 68 65 20 72 65 6c | 65 76 61 6e 74 20 64 61 | the rel|evant da|
|00001670| 74 61 20 69 6e 74 6f 20 | 61 20 6e 65 77 20 41 45 |ta into |a new AE|
|00001680| 52 65 71 75 65 73 74 20 | 6f 62 6a 65 63 74 2e 20 |Request |object. |
|00001690| 54 68 65 6e 20 69 74 20 | 63 61 6c 6c 73 20 74 68 |Then it |calls th|
|000016a0| 65 20 52 65 71 75 65 73 | 74 44 69 73 70 61 74 63 |e Reques|tDispatc|
|000016b0| 68 65 72 20 51 75 65 75 | 65 52 65 71 75 65 73 74 |her Queu|eRequest|
|000016c0| 28 29 20 66 75 6e 63 74 | 69 6f 6e 20 74 6f 20 61 |() funct|ion to a|
|000016d0| 64 64 20 74 68 65 20 41 | 45 52 65 71 75 65 73 74 |dd the A|ERequest|
|000016e0| 20 74 6f 20 74 68 65 20 | 65 6e 64 20 6f 66 20 74 | to the |end of t|
|000016f0| 68 65 20 70 65 6e 64 69 | 6e 67 20 72 65 71 75 65 |he pendi|ng reque|
|00001700| 73 74 20 71 75 65 75 65 | 2e 20 54 68 65 20 6e 65 |st queue|. The ne|
|00001710| 78 74 20 74 69 6d 65 20 | 52 75 6e 28 29 20 67 69 |xt time |Run() gi|
|00001720| 76 65 73 20 74 68 65 20 | 52 65 71 75 65 73 74 44 |ves the |RequestD|
|00001730| 69 73 70 61 74 63 68 65 | 72 20 73 6f 6d 65 20 74 |ispatche|r some t|
|00001740| 69 6d 65 2c 20 44 6f 52 | 65 71 75 65 73 74 73 28 |ime, DoR|equests(|
|00001750| 29 20 72 65 6d 6f 76 65 | 73 20 74 68 65 20 66 69 |) remove|s the fi|
|00001760| 72 73 74 20 69 74 65 6d | 20 66 72 6f 6d 20 74 68 |rst item| from th|
|00001770| 65 20 71 75 65 75 65 20 | 61 6e 64 20 70 72 6f 63 |e queue |and proc|
|00001780| 65 73 73 65 73 20 69 74 | 2e 0d 09 54 68 65 20 52 |esses it|...The R|
|00001790| 75 6e 28 29 20 6c 6f 6f | 70 20 74 65 72 6d 69 6e |un() loo|p termin|
|000017a0| 61 74 65 73 20 77 68 65 | 6e 20 74 68 65 20 41 70 |ates whe|n the Ap|
|000017b0| 70 6c 69 63 61 74 69 6f | 6e 20 6d 65 6d 62 65 72 |plicatio|n member|
|000017c0| 20 6e 61 6d 65 64 20 66 | 44 6f 6e 65 20 69 73 20 | named f|Done is |
|000017d0| 73 65 74 20 74 6f 20 74 | 72 75 65 20 62 79 20 74 |set to t|rue by t|
|000017e0| 68 65 20 41 70 70 6c 69 | 63 61 74 69 6f 6e 20 54 |he Appli|cation T|
|000017f0| 65 72 6d 69 6e 61 74 65 | 28 29 20 66 75 6e 63 74 |erminate|() funct|
|00001800| 69 6f 6e 2e 20 54 65 72 | 6d 69 6e 61 74 65 28 29 |ion. Ter|minate()|
|00001810| 20 69 73 20 63 61 6c 6c | 65 64 20 62 79 20 74 68 | is call|ed by th|
|00001820| 65 20 72 6f 75 74 69 6e | 65 20 74 68 61 74 20 68 |e routin|e that h|
|00001830| 61 6e 64 6c 65 73 20 74 | 68 65 20 51 75 69 74 20 |andles t|he Quit |
|00001840| 6d 65 6e 75 20 69 74 65 | 6d 2e 20 42 65 66 6f 72 |menu ite|m. Befor|
|00001850| 65 20 73 65 74 74 69 6e | 67 20 74 68 65 20 66 44 |e settin|g the fD|
|00001860| 6f 6e 65 20 66 6c 61 67 | 2c 20 69 74 20 63 61 6c |one flag|, it cal|
|00001870| 6c 73 20 74 68 65 20 45 | 78 69 74 4c 6f 6f 70 28 |ls the E|xitLoop(|
|00001880| 29 20 66 75 6e 63 74 69 | 6f 6e 20 74 6f 20 65 6e |) functi|on to en|
|00001890| 73 75 72 65 73 20 61 6c | 6c 20 70 65 6e 64 69 6e |sures al|l pendin|
|000018a0| 67 20 6f 72 20 61 63 74 | 69 76 65 20 72 65 71 75 |g or act|ive requ|
|000018b0| 65 73 74 73 20 61 72 65 | 20 63 61 6e 63 65 6c 65 |ests are| cancele|
|000018c0| 64 2e 20 54 68 65 20 73 | 61 6d 65 20 54 65 72 6d |d. The s|ame Term|
|000018d0| 69 6e 61 74 65 28 29 20 | 66 75 6e 63 74 69 6f 6e |inate() |function|
|000018e0| 20 69 73 20 63 61 6c 6c | 65 64 20 77 68 65 6e 20 | is call|ed when |
|000018f0| 74 68 65 20 75 73 65 72 | 20 63 68 6f 6f 73 65 73 |the user| chooses|
|00001900| 20 74 68 65 20 51 75 69 | 74 20 6d 65 6e 75 20 69 | the Qui|t menu i|
|00001910| 74 65 6d 20 6f 72 20 69 | 6e 20 72 65 73 70 6f 6e |tem or i|n respon|
|00001920| 73 65 20 74 6f 20 61 20 | 27 51 75 69 74 27 20 73 |se to a |'Quit' s|
|00001930| 65 72 76 69 63 65 20 72 | 65 71 75 65 73 74 2e 0d |ervice r|equest..|
|00001940| 09 0d 52 65 71 75 65 73 | 74 44 69 73 70 61 74 63 |..Reques|tDispatc|
|00001950| 68 65 72 20 4f 62 6a 65 | 63 74 0d 09 54 68 65 20 |her Obje|ct..The |
|00001960| 52 65 71 75 65 73 74 44 | 69 73 70 61 74 63 68 65 |RequestD|ispatche|
|00001970| 72 20 6f 62 6a 65 63 74 | 20 6d 61 6e 61 67 65 73 |r object| manages|
|00001980| 20 65 61 63 68 20 73 65 | 72 76 69 63 65 20 72 65 | each se|rvice re|
|00001990| 71 75 65 73 74 20 66 72 | 6f 6d 20 74 68 65 20 74 |quest fr|om the t|
|000019a0| 69 6d 65 20 69 74 20 69 | 73 20 71 75 65 75 65 64 |ime it i|s queued|
|000019b0| 20 62 79 20 74 68 65 20 | 41 70 70 6c 69 63 61 74 | by the |Applicat|
|000019c0| 69 6f 6e 20 75 6e 74 69 | 6c 20 69 74 20 74 65 72 |ion unti|l it ter|
|000019d0| 6d 69 6e 61 74 65 73 2e | 20 57 68 69 6c 65 20 74 |minates.| While t|
|000019e0| 68 65 20 41 70 70 6c 69 | 63 61 74 69 6f 6e 20 69 |he Appli|cation i|
|000019f0| 73 20 70 6f 69 6e 74 65 | 64 20 6f 75 74 77 61 72 |s pointe|d outwar|
|00001a00| 64 73 20 61 6e 64 20 68 | 61 73 20 61 20 67 65 6e |ds and h|as a gen|
|00001a10| 65 72 61 6c 20 73 63 6f | 70 65 2c 20 74 68 65 20 |eral sco|pe, the |
|00001a20| 52 65 71 75 65 73 74 44 | 69 73 70 61 74 63 68 65 |RequestD|ispatche|
|00001a30| 72 20 69 73 20 70 6f 69 | 6e 74 65 64 20 69 6e 77 |r is poi|nted inw|
|00001a40| 61 72 64 73 20 61 6e 64 | 20 68 61 73 20 61 20 6d |ards and| has a m|
|00001a50| 6f 72 65 20 66 6f 63 75 | 73 65 64 20 70 75 72 70 |ore focu|sed purp|
|00001a60| 6f 73 65 2c 20 64 65 61 | 6c 69 6e 67 20 77 69 74 |ose, dea|ling wit|
|00001a70| 68 20 74 68 65 20 75 6e | 69 71 75 65 20 69 6e 74 |h the un|ique int|
|00001a80| 65 72 6e 61 6c 20 6d 65 | 63 68 61 6e 69 63 73 20 |ernal me|chanics |
|00001a90| 74 68 65 20 74 6f 6f 6c | 20 75 73 65 73 20 74 6f |the tool| uses to|
|00001aa0| 20 6d 61 6e 61 67 65 20 | 56 55 20 73 65 72 76 69 | manage |VU servi|
|00001ab0| 63 65 20 72 65 71 75 65 | 73 74 2e 0d 09 54 68 65 |ce reque|st...The|
|00001ac0| 20 52 65 71 75 65 73 74 | 44 69 73 70 61 74 63 68 | Request|Dispatch|
|00001ad0| 65 72 20 72 65 63 65 69 | 76 65 73 20 74 69 6d 65 |er recei|ves time|
|00001ae0| 20 74 6f 20 70 65 72 66 | 6f 72 6d 20 69 74 73 20 | to perf|orm its |
|00001af0| 64 75 74 69 65 73 20 77 | 68 65 6e 20 74 68 65 20 |duties w|hen the |
|00001b00| 41 70 70 6c 69 63 61 74 | 69 6f 6e 20 52 75 6e 28 |Applicat|ion Run(|
|00001b10| 29 20 6c 6f 6f 70 20 63 | 61 6c 6c 73 20 69 74 73 |) loop c|alls its|
|00001b20| 20 44 6f 52 65 71 75 65 | 73 74 73 28 29 20 66 75 | DoReque|sts() fu|
|00001b30| 6e 63 74 69 6f 6e 2e 20 | 54 68 69 73 20 66 75 6e |nction. |This fun|
|00001b40| 63 74 69 6f 6e 20 66 69 | 72 73 74 20 63 61 6c 6c |ction fi|rst call|
|00001b50| 73 20 74 68 65 20 52 65 | 73 65 74 41 6c 6c 54 69 |s the Re|setAllTi|
|00001b60| 6d 65 6f 75 74 43 6f 75 | 6e 74 65 72 73 28 29 20 |meoutCou|nters() |
|00001b70| 66 75 6e 63 74 69 6f 6e | 2c 20 77 68 69 63 68 20 |function|, which |
|00001b80| 73 65 6e 64 73 20 61 6e | 20 41 70 70 6c 65 20 65 |sends an| Apple e|
|00001b90| 76 65 6e 74 20 74 6f 20 | 56 55 20 28 6f 72 20 77 |vent to |VU (or w|
|00001ba0| 68 61 74 65 76 65 72 20 | 61 70 70 6c 69 63 61 74 |hatever |applicat|
|00001bb0| 69 6f 6e 20 73 65 6e 74 | 20 74 68 65 20 6f 72 69 |ion sent| the ori|
|00001bc0| 67 69 6e 61 6c 20 72 65 | 71 75 65 73 74 29 20 66 |ginal re|quest) f|
|00001bd0| 6f 72 20 65 61 63 68 20 | 52 65 71 75 65 73 74 20 |or each |Request |
|00001be0| 6f 62 6a 65 63 74 20 74 | 68 61 74 20 6e 65 65 64 |object t|hat need|
|00001bf0| 73 20 6d 6f 72 65 20 74 | 69 6d 65 2e 20 54 68 69 |s more t|ime. Thi|
|00001c00| 73 20 77 61 79 20 74 68 | 65 20 73 65 72 76 69 63 |s way th|e servic|
|00001c10| 65 20 64 65 73 69 67 6e | 65 72 20 63 61 6e 20 66 |e design|er can f|
|00001c20| 6f 63 75 73 20 6f 6e 20 | 74 68 65 20 74 61 73 6b |ocus on |the task|
|00001c30| 20 61 74 20 68 61 6e 64 | 20 61 6e 64 20 6e 6f 74 | at hand| and not|
|00001c40| 20 68 61 76 65 20 74 6f | 20 77 6f 72 72 79 20 74 | have to| worry t|
|00001c50| 68 61 74 20 74 68 65 20 | 52 65 71 75 65 73 74 20 |hat the |Request |
|00001c60| 77 69 6c 6c 20 74 69 6d | 65 20 6f 75 74 20 61 74 |will tim|e out at|
|00001c70| 20 74 68 65 20 56 55 20 | 73 63 72 69 70 74 20 73 | the VU |script s|
|00001c80| 69 64 65 2e 20 54 68 65 | 20 61 6d 6f 75 6e 74 20 |ide. The| amount |
|00001c90| 6f 66 20 74 69 6d 65 20 | 74 6f 20 61 73 6b 20 66 |of time |to ask f|
|00001ca0| 6f 72 20 64 65 70 65 6e | 64 73 20 6f 6e 20 74 68 |or depen|ds on th|
|00001cb0| 65 20 53 65 72 76 69 63 | 65 20 6f 62 6a 65 63 74 |e Servic|e object|
|00001cc0| 20 64 65 66 69 6e 69 74 | 69 6f 6e 2e 20 4e 6f 74 | definit|ion. Not|
|00001cd0| 65 20 74 68 61 74 20 41 | 70 70 6c 65 20 53 63 72 |e that A|pple Scr|
|00001ce0| 69 70 74 20 68 61 73 20 | 69 74 73 20 6f 77 6e 20 |ipt has |its own |
|00001cf0| 74 69 6d 65 6f 75 74 20 | 61 6c 67 6f 72 69 74 68 |timeout |algorith|
|00001d00| 6d 73 20 61 6e 64 20 69 | 67 6e 6f 72 65 73 20 72 |ms and i|gnores r|
|00001d10| 65 71 75 65 73 74 73 20 | 66 6f 72 20 6d 6f 72 65 |equests |for more|
|00001d20| 20 74 69 6d 65 2e 20 0d | 09 41 66 74 65 72 20 70 | time. .|.After p|
|00001d30| 65 72 66 6f 72 6d 69 6e | 67 20 74 68 69 73 20 70 |erformin|g this p|
|00001d40| 69 6f 75 73 20 64 75 74 | 79 2c 20 44 6f 52 65 71 |ious dut|y, DoReq|
|00001d50| 75 65 73 74 73 28 29 20 | 65 78 61 6d 69 6e 65 73 |uests() |examines|
|00001d60| 20 74 68 65 20 70 65 6e | 64 69 6e 67 20 72 65 71 | the pen|ding req|
|00001d70| 75 65 73 74 20 71 75 65 | 75 65 2e 20 49 66 20 74 |uest que|ue. If t|
|00001d80| 68 65 20 71 75 65 75 65 | 20 63 6f 6e 74 61 69 6e |he queue| contain|
|00001d90| 73 20 61 6e 79 20 69 74 | 65 6d 73 2c 20 44 6f 52 |s any it|ems, DoR|
|00001da0| 65 71 75 65 73 74 73 28 | 29 20 72 65 6d 6f 76 65 |equests(|) remove|
|00001db0| 73 20 74 68 65 20 6c 65 | 61 73 74 20 72 65 63 65 |s the le|ast rece|
|00001dc0| 6e 74 20 6f 6e 65 20 61 | 6e 64 2c 20 69 66 20 69 |nt one a|nd, if i|
|00001dd0| 74 20 68 61 73 20 6e 6f | 74 20 62 65 65 6e 20 63 |t has no|t been c|
|00001de0| 61 6e 63 65 6c 65 64 20 | 77 68 69 6c 65 20 69 6e |anceled |while in|
|00001df0| 20 74 68 65 20 71 75 65 | 75 65 2c 20 70 61 73 73 | the que|ue, pass|
|00001e00| 65 73 20 69 74 20 74 6f | 20 74 68 65 20 52 65 71 |es it to| the Req|
|00001e10| 75 65 73 74 44 69 73 70 | 61 74 63 68 65 72 20 50 |uestDisp|atcher P|
|00001e20| 72 6f 63 65 73 73 52 65 | 71 75 65 73 74 28 29 20 |rocessRe|quest() |
|00001e30| 66 75 6e 63 74 69 6f 6e | 2e 20 0d 09 53 6f 6d 65 |function|. ..Some|
|00001e40| 20 73 65 72 76 69 63 65 | 73 20 61 72 65 20 70 72 | service|s are pr|
|00001e50| 6f 63 65 73 73 65 64 20 | 64 69 72 65 63 74 6c 79 |ocessed |directly|
|00001e60| 20 62 79 20 50 72 6f 63 | 65 73 73 52 65 71 75 65 | by Proc|essReque|
|00001e70| 73 74 28 29 2e 20 54 68 | 65 73 65 20 61 72 65 20 |st(). Th|ese are |
|00001e80| 74 68 65 20 72 65 71 75 | 69 72 65 64 20 56 55 20 |the requ|ired VU |
|00001e90| 65 78 74 65 72 6e 61 6c | 20 74 6f 6f 6c 20 73 65 |external| tool se|
|00001ea0| 72 76 69 63 65 73 3a 20 | 49 6e 69 74 69 61 6c 69 |rvices: |Initiali|
|00001eb0| 7a 65 2c 20 51 75 69 74 | 2c 20 47 65 74 54 6f 6f |ze, Quit|, GetToo|
|00001ec0| 6c 56 65 72 73 69 6f 6e | 2c 20 47 65 74 54 6f 6f |lVersion|, GetToo|
|00001ed0| 6c 53 65 72 76 69 63 65 | 73 2c 20 61 6e 64 20 53 |lService|s, and S|
|00001ee0| 65 72 76 69 63 65 53 75 | 70 70 6f 72 74 65 64 2e |erviceSu|pported.|
|00001ef0| 20 43 6f 64 65 20 74 6f | 20 65 78 65 63 75 74 65 | Code to| execute|
|00001f00| 20 74 68 65 73 65 20 73 | 65 72 76 69 63 65 73 20 | these s|ervices |
|00001f10| 69 73 20 64 65 66 69 6e | 65 64 20 69 6e 20 73 65 |is defin|ed in se|
|00001f20| 70 61 72 61 74 65 20 6d | 65 6d 62 65 72 20 66 75 |parate m|ember fu|
|00001f30| 6e 63 74 69 6f 6e 73 20 | 6f 66 20 74 68 65 20 52 |nctions |of the R|
|00001f40| 65 71 75 65 73 74 44 69 | 73 70 61 74 63 68 65 72 |equestDi|spatcher|
|00001f50| 2c 20 61 6e 64 20 61 72 | 65 20 70 72 6f 63 65 73 |, and ar|e proces|
|00001f60| 73 65 64 20 69 6d 6d 65 | 64 69 61 74 65 6c 79 20 |sed imme|diately |
|00001f70| 77 69 74 68 20 6e 6f 20 | 69 6e 74 65 72 72 75 70 |with no |interrup|
|00001f80| 74 69 6f 6e 2c 20 69 2e | 65 2e 20 74 68 65 72 65 |tion, i.|e. there|
|00001f90| 20 61 72 65 20 6e 6f 20 | 63 61 6c 6c 73 20 74 6f | are no |calls to|
|00001fa0| 20 74 68 65 20 45 76 65 | 6e 74 20 4d 61 6e 61 67 | the Eve|nt Manag|
|00001fb0| 65 72 2e 20 54 68 65 20 | 50 6f 6c 6c 20 73 65 72 |er. The |Poll ser|
|00001fc0| 76 69 63 65 20 69 73 20 | 70 72 6f 63 65 73 73 65 |vice is |processe|
|00001fd0| 64 20 62 79 20 74 68 65 | 20 56 69 72 74 75 61 6c |d by the| Virtual|
|00001fe0| 20 55 73 65 72 20 61 70 | 70 6c 69 63 61 74 69 6f | User ap|plicatio|
|00001ff0| 6e 20 66 6f 72 20 61 73 | 79 6e 63 68 72 6f 6e 6f |n for as|ynchrono|
|00002000| 75 73 20 73 65 72 76 69 | 63 65 20 63 61 6c 6c 73 |us servi|ce calls|
|00002010| 2c 20 61 6e 64 20 69 73 | 20 6e 65 76 65 72 20 73 |, and is| never s|
|00002020| 65 65 6e 20 62 79 20 74 | 68 65 20 65 78 74 65 72 |een by t|he exter|
|00002030| 6e 61 6c 20 74 6f 6f 6c | 20 69 74 73 65 6c 66 2e |nal tool| itself.|
|00002040| 20 0d 09 49 66 20 61 20 | 73 65 72 76 69 63 65 20 | ..If a |service |
|00002050| 63 61 6c 6c 20 69 73 20 | 6e 6f 74 20 6f 6e 65 20 |call is |not one |
|00002060| 6f 66 20 74 68 65 20 72 | 65 71 75 69 72 65 64 20 |of the r|equired |
|00002070| 73 65 72 76 69 63 65 73 | 2c 20 50 72 6f 63 65 73 |services|, Proces|
|00002080| 73 52 65 71 75 65 73 74 | 28 29 20 70 61 73 73 65 |sRequest|() passe|
|00002090| 73 20 74 68 65 20 72 65 | 71 75 65 73 74 20 74 6f |s the re|quest to|
|000020a0| 20 74 68 65 20 44 69 73 | 70 61 74 63 68 43 75 73 | the Dis|patchCus|
|000020b0| 74 6f 6d 52 65 71 75 65 | 73 74 28 29 20 66 75 6e |tomReque|st() fun|
|000020c0| 63 74 69 6f 6e 2e 20 54 | 68 69 73 20 66 75 6e 63 |ction. T|his func|
|000020d0| 74 69 6f 6e 20 6c 6f 6f | 6b 73 20 75 70 20 74 68 |tion loo|ks up th|
|000020e0| 65 20 70 72 6f 70 65 72 | 20 53 65 72 76 69 63 65 |e proper| Service|
|000020f0| 20 6f 62 6a 65 63 74 20 | 62 79 20 6e 61 6d 65 2e | object |by name.|
|00002100| 20 49 66 20 74 68 65 20 | 53 65 72 76 69 63 65 20 | If the |Service |
|00002110| 65 78 69 73 74 73 2c 20 | 44 69 73 70 61 74 63 68 |exists, |Dispatch|
|00002120| 43 75 73 74 6f 6d 52 65 | 71 75 65 73 74 28 29 20 |CustomRe|quest() |
|00002130| 73 74 6f 72 65 73 20 61 | 20 70 6f 69 6e 74 65 72 |stores a| pointer|
|00002140| 20 74 6f 20 74 68 65 20 | 53 65 72 76 69 63 65 20 | to the |Service |
|00002150| 69 6e 20 74 68 65 20 52 | 65 71 75 65 73 74 20 6f |in the R|equest o|
|00002160| 62 6a 65 63 74 2e 20 54 | 68 65 6e 20 69 74 20 70 |bject. T|hen it p|
|00002170| 6c 61 63 65 73 20 74 68 | 65 20 52 65 71 75 65 73 |laces th|e Reques|
|00002180| 74 20 6f 62 6a 65 63 74 | 20 69 6e 74 6f 20 74 68 |t object| into th|
|00002190| 65 20 61 63 74 69 76 65 | 20 72 65 71 75 65 73 74 |e active| request|
|000021a0| 20 6c 69 73 74 20 61 6e | 64 20 70 61 73 73 65 73 | list an|d passes|
|000021b0| 20 74 68 65 20 52 65 71 | 75 65 73 74 20 6f 62 6a | the Req|uest obj|
|000021c0| 65 63 74 20 74 6f 20 74 | 68 65 20 53 65 72 76 69 |ect to t|he Servi|
|000021d0| 63 65 20 50 72 6f 63 65 | 73 73 52 65 71 75 65 73 |ce Proce|ssReques|
|000021e0| 74 28 29 20 66 75 6e 63 | 74 69 6f 6e 2e 0d 09 57 |t() func|tion...W|
|000021f0| 68 65 6e 20 74 68 65 20 | 53 65 72 76 69 63 65 20 |hen the |Service |
|00002200| 50 72 6f 63 65 73 73 52 | 65 71 75 65 73 74 28 29 |ProcessR|equest()|
|00002210| 20 66 75 6e 63 74 69 6f | 6e 20 69 73 20 66 69 6e | functio|n is fin|
|00002220| 69 73 68 65 64 20 70 72 | 6f 63 65 73 73 69 6e 67 |ished pr|ocessing|
|00002230| 20 61 20 72 65 71 75 65 | 73 74 20 69 74 20 73 69 | a reque|st it si|
|00002240| 6d 70 6c 79 20 72 65 74 | 75 72 6e 73 2e 20 57 68 |mply ret|urns. Wh|
|00002250| 65 74 68 65 72 20 74 68 | 65 20 73 65 72 76 69 63 |ether th|e servic|
|00002260| 65 20 77 61 73 20 72 65 | 71 75 69 72 65 64 20 6f |e was re|quired o|
|00002270| 72 20 63 75 73 74 6f 6d | 2c 20 74 68 65 20 72 65 |r custom|, the re|
|00002280| 74 75 72 6e 20 63 68 61 | 69 6e 20 65 6e 64 73 20 |turn cha|in ends |
|00002290| 75 70 20 69 6e 20 74 68 | 65 20 52 65 71 75 65 73 |up in th|e Reques|
|000022a0| 74 44 69 73 70 61 74 63 | 68 65 72 20 50 72 6f 63 |tDispatc|her Proc|
|000022b0| 65 73 73 52 65 71 75 65 | 73 74 28 29 20 66 75 6e |essReque|st() fun|
|000022c0| 63 74 69 6f 6e 2e 20 50 | 72 6f 63 65 73 73 52 65 |ction. P|rocessRe|
|000022d0| 71 75 65 73 74 28 29 20 | 72 65 74 75 72 6e 73 20 |quest() |returns |
|000022e0| 74 6f 20 44 6f 52 65 71 | 75 65 73 74 73 28 29 2c |to DoReq|uests(),|
|000022f0| 20 77 68 69 63 68 20 63 | 6f 6d 70 6c 65 74 65 73 | which c|ompletes|
|00002300| 20 74 68 65 20 73 65 72 | 76 69 63 65 20 72 65 71 | the ser|vice req|
|00002310| 75 65 73 74 20 62 79 20 | 63 61 6c 6c 69 6e 67 20 |uest by |calling |
|00002320| 74 68 65 20 52 65 71 75 | 65 73 74 49 73 44 6f 6e |the Requ|estIsDon|
|00002330| 65 28 29 20 66 75 6e 63 | 74 69 6f 6e 2e 20 54 68 |e() func|tion. Th|
|00002340| 69 73 20 66 75 6e 63 74 | 69 6f 6e 20 73 65 6e 64 |is funct|ion send|
|00002350| 73 20 74 68 65 20 72 65 | 73 75 6c 74 2c 20 72 65 |s the re|sult, re|
|00002360| 6d 6f 76 65 73 20 74 68 | 65 20 6f 62 6a 65 63 74 |moves th|e object|
|00002370| 20 66 72 6f 6d 20 74 68 | 65 20 61 63 74 69 76 65 | from th|e active|
|00002380| 20 72 65 71 75 65 73 74 | 20 6c 69 73 74 2c 20 64 | request| list, d|
|00002390| 65 6c 65 74 65 73 20 74 | 68 65 20 52 65 71 75 65 |eletes t|he Reque|
|000023a0| 73 74 20 6f 62 6a 65 63 | 74 20 61 6e 64 20 72 65 |st objec|t and re|
|000023b0| 74 75 72 6e 73 20 74 6f | 20 44 6f 52 65 71 75 65 |turns to| DoReque|
|000023c0| 73 74 73 28 29 2e 20 0d | 09 41 20 43 61 6e 63 65 |sts(). .|.A Cance|
|000023d0| 6c 20 72 65 71 75 65 73 | 74 20 69 73 20 61 20 73 |l reques|t is a s|
|000023e0| 70 65 63 69 61 6c 20 63 | 61 73 65 2c 20 65 76 65 |pecial c|ase, eve|
|000023f0| 6e 20 74 68 6f 75 67 68 | 20 69 74 20 69 73 20 6f |n though| it is o|
|00002400| 6e 65 20 6f 66 20 74 68 | 65 20 72 65 71 75 69 72 |ne of th|e requir|
|00002410| 65 64 20 73 65 72 76 69 | 63 65 73 2e 20 49 74 20 |ed servi|ces. It |
|00002420| 6f 6e 6c 79 20 61 70 70 | 6c 69 65 73 20 74 6f 20 |only app|lies to |
|00002430| 73 65 72 76 69 63 65 20 | 63 61 6c 6c 73 20 74 68 |service |calls th|
|00002440| 61 74 20 61 72 65 20 6d | 61 64 65 20 61 73 79 6e |at are m|ade asyn|
|00002450| 63 68 72 6f 6e 6f 75 73 | 6c 79 20 66 72 6f 6d 20 |chronous|ly from |
|00002460| 61 20 56 69 72 74 75 61 | 6c 20 55 73 65 72 20 73 |a Virtua|l User s|
|00002470| 63 72 69 70 74 2e 20 41 | 20 63 61 6e 63 65 6c 20 |cript. A| cancel |
|00002480| 69 73 20 6e 6f 74 20 70 | 6c 61 63 65 64 20 69 6e |is not p|laced in|
|00002490| 20 74 68 65 20 70 65 6e | 64 69 6e 67 20 72 65 71 | the pen|ding req|
|000024a0| 75 65 73 74 20 71 75 65 | 75 65 2e 20 49 6e 73 74 |uest que|ue. Inst|
|000024b0| 65 61 64 2c 20 69 74 20 | 69 73 20 65 78 65 63 75 |ead, it |is execu|
|000024c0| 74 65 64 20 69 6d 6d 65 | 64 69 61 74 65 6c 79 20 |ted imme|diately |
|000024d0| 62 79 20 74 68 65 20 41 | 70 70 6c 65 20 65 76 65 |by the A|pple eve|
|000024e0| 6e 74 20 68 61 6e 64 6c | 65 72 20 66 6f 72 20 56 |nt handl|er for V|
|000024f0| 55 20 73 65 72 76 69 63 | 65 20 63 61 6c 6c 73 2e |U servic|e calls.|
|00002500| 20 52 65 71 75 65 73 74 | 73 20 61 72 65 20 63 61 | Request|s are ca|
|00002510| 6e 63 65 6c 65 64 20 61 | 73 79 6e 63 68 72 6f 6e |nceled a|synchron|
|00002520| 6f 75 73 6c 79 20 72 65 | 6c 61 74 69 76 65 20 74 |ously re|lative t|
|00002530| 6f 20 74 68 65 69 72 20 | 73 65 72 76 69 63 65 20 |o their |service |
|00002540| 63 6f 64 65 20 77 68 65 | 6e 20 74 68 65 20 68 61 |code whe|n the ha|
|00002550| 6e 64 6c 65 72 20 63 61 | 6c 6c 73 20 74 68 65 20 |ndler ca|lls the |
|00002560| 52 65 71 75 65 73 74 20 | 43 61 6e 63 65 6c 54 68 |Request |CancelTh|
|00002570| 69 73 52 65 71 75 65 73 | 74 28 29 20 66 75 6e 63 |isReques|t() func|
|00002580| 74 69 6f 6e 2e 20 54 68 | 69 73 20 64 6f 65 73 20 |tion. Th|is does |
|00002590| 6e 6f 74 20 61 63 74 75 | 61 6c 6c 79 20 73 74 6f |not actu|ally sto|
|000025a0| 70 20 70 72 6f 63 65 73 | 73 69 6e 67 20 6f 66 20 |p proces|sing of |
|000025b0| 74 68 65 20 72 65 71 75 | 65 73 74 2c 20 69 74 20 |the requ|est, it |
|000025c0| 6a 75 73 74 20 73 65 74 | 73 20 61 20 66 6c 61 67 |just set|s a flag|
|000025d0| 20 69 6e 20 74 68 65 20 | 52 65 71 75 65 73 74 20 | in the |Request |
|000025e0| 6f 62 6a 65 63 74 2e 20 | 0d 09 53 65 72 76 69 63 |object. |..Servic|
|000025f0| 65 20 63 61 6c 6c 73 20 | 6d 61 64 65 20 73 79 6e |e calls |made syn|
|00002600| 63 68 72 6f 6e 6f 75 73 | 6c 79 20 63 61 6e 20 6e |chronous|ly can n|
|00002610| 6f 74 20 62 65 20 63 61 | 6e 63 65 6c 65 64 20 66 |ot be ca|nceled f|
|00002620| 72 6f 6d 20 61 20 56 55 | 20 73 63 72 69 70 74 2e |rom a VU| script.|
|00002630| 20 4f 6e 20 74 68 65 20 | 6f 74 68 65 72 20 68 61 | On the |other ha|
|00002640| 6e 64 2c 20 61 6e 20 61 | 73 79 6e 63 68 72 6f 6e |nd, an a|synchron|
|00002650| 6f 75 73 20 73 65 72 76 | 69 63 65 20 63 61 6c 6c |ous serv|ice call|
|00002660| 20 63 61 6e 20 62 65 20 | 63 61 6e 63 65 6c 65 64 | can be |canceled|
|00002670| 20 77 68 69 6c 65 20 69 | 74 20 69 73 20 69 6e 20 | while i|t is in |
|00002680| 74 68 65 20 70 65 6e 64 | 69 6e 67 20 72 65 71 75 |the pend|ing requ|
|00002690| 65 73 74 20 71 75 65 75 | 65 20 6f 72 20 77 68 69 |est queu|e or whi|
|000026a0| 6c 65 20 69 74 20 69 73 | 20 62 65 69 6e 67 20 70 |le it is| being p|
|000026b0| 72 6f 63 65 73 73 65 64 | 2e 20 41 6e 20 65 78 63 |rocessed|. An exc|
|000026c0| 65 70 74 69 6f 6e 20 74 | 6f 20 74 68 69 73 20 72 |eption t|o this r|
|000026d0| 75 6c 65 20 69 73 20 61 | 20 72 65 71 75 69 72 65 |ule is a| require|
|000026e0| 64 20 28 69 6d 6d 65 64 | 69 61 74 65 29 20 73 65 |d (immed|iate) se|
|000026f0| 72 76 69 63 65 20 74 68 | 61 74 20 63 61 6e 20 6e |rvice th|at can n|
|00002700| 6f 74 20 62 65 20 63 61 | 6e 63 65 6c 65 64 20 6f |ot be ca|nceled o|
|00002710| 6e 63 65 20 69 74 20 69 | 73 20 72 65 6d 6f 76 65 |nce it i|s remove|
|00002720| 64 20 66 72 6f 6d 20 74 | 68 65 20 70 65 6e 64 69 |d from t|he pendi|
|00002730| 6e 67 20 72 65 71 75 65 | 73 74 20 71 75 65 75 65 |ng reque|st queue|
|00002740| 2e 20 49 6e 20 61 6e 79 | 20 63 61 73 65 2c 20 74 |. In any| case, t|
|00002750| 68 65 20 73 63 72 69 70 | 74 20 74 72 79 69 6e 67 |he scrip|t trying|
|00002760| 20 74 6f 20 63 61 6e 63 | 65 6c 20 61 20 72 65 71 | to canc|el a req|
|00002770| 75 65 73 74 20 64 6f 65 | 73 20 6e 6f 74 20 6e 65 |uest doe|s not ne|
|00002780| 65 64 20 74 6f 20 6b 6e | 6f 77 20 74 68 65 20 73 |ed to kn|ow the s|
|00002790| 74 61 74 75 73 20 6f 66 | 20 74 68 65 20 72 65 71 |tatus of| the req|
|000027a0| 75 65 73 74 20 6f 72 20 | 77 68 69 63 68 20 71 75 |uest or |which qu|
|000027b0| 65 75 65 20 69 74 20 69 | 73 20 69 6e 2e 0d 53 65 |eue it i|s in..Se|
|000027c0| 72 76 69 63 65 20 4f 62 | 6a 65 63 74 0d 09 41 20 |rvice Ob|ject..A |
|000027d0| 53 65 72 76 69 63 65 20 | 6f 62 6a 65 63 74 20 63 |Service |object c|
|000027e0| 6f 6e 74 61 69 6e 73 20 | 61 6c 6c 20 74 68 65 20 |ontains |all the |
|000027f0| 63 6f 64 65 20 61 6e 64 | 20 64 61 74 61 20 6e 65 |code and| data ne|
|00002800| 63 65 73 73 61 72 79 20 | 74 6f 20 70 72 6f 63 65 |cessary |to proce|
|00002810| 73 73 20 61 20 70 61 72 | 74 69 63 75 6c 61 72 20 |ss a par|ticular |
|00002820| 6b 69 6e 64 20 6f 66 20 | 63 75 73 74 6f 6d 20 73 |kind of |custom s|
|00002830| 65 72 76 69 63 65 20 63 | 61 6c 6c 2c 20 61 6c 74 |ervice c|all, alt|
|00002840| 68 6f 75 67 68 20 6e 6f | 6e 65 20 6f 66 20 74 68 |hough no|ne of th|
|00002850| 65 20 64 61 74 61 20 70 | 61 72 74 61 69 6e 73 20 |e data p|artains |
|00002860| 74 6f 20 61 6e 79 20 73 | 70 65 63 69 66 69 63 20 |to any s|pecific |
|00002870| 73 65 72 76 69 63 65 20 | 63 61 6c 6c 20 66 72 6f |service |call fro|
|00002880| 6d 20 61 20 73 63 72 69 | 70 74 2e 20 57 68 65 6e |m a scri|pt. When|
|00002890| 20 74 68 65 20 52 65 71 | 75 65 73 74 44 69 73 70 | the Req|uestDisp|
|000028a0| 61 74 63 68 65 72 20 69 | 73 20 63 72 65 61 74 65 |atcher i|s create|
|000028b0| 64 2c 20 69 74 20 62 75 | 69 6c 64 73 20 61 20 6c |d, it bu|ilds a l|
|000028c0| 69 73 74 20 6f 66 20 61 | 6c 6c 20 74 68 65 20 63 |ist of a|ll the c|
|000028d0| 75 73 74 6f 6d 20 53 65 | 72 76 69 63 65 20 6f 62 |ustom Se|rvice ob|
|000028e0| 6a 65 63 74 73 20 63 6f | 6d 70 69 6c 65 64 20 69 |jects co|mpiled i|
|000028f0| 6e 74 6f 20 74 68 65 20 | 74 6f 6f 6c 2e 20 4f 6e |nto the |tool. On|
|00002900| 65 20 61 6e 64 20 6f 6e | 6c 79 20 6f 6e 65 20 53 |e and on|ly one S|
|00002910| 65 72 76 69 63 65 20 6f | 62 6a 65 63 74 20 69 73 |ervice o|bject is|
|00002920| 20 63 72 65 61 74 65 64 | 20 66 6f 72 20 65 61 63 | created| for eac|
|00002930| 68 20 73 75 70 70 6f 72 | 74 65 64 20 63 75 73 74 |h suppor|ted cust|
|00002940| 6f 6d 20 73 65 72 76 69 | 63 65 2c 20 61 6e 64 20 |om servi|ce, and |
|00002950| 61 6c 6c 20 53 65 72 76 | 69 63 65 20 6f 62 6a 65 |all Serv|ice obje|
|00002960| 63 74 73 20 70 65 72 73 | 69 73 74 20 75 6e 74 69 |cts pers|ist unti|
|00002970| 6c 20 74 68 65 20 52 65 | 71 75 65 73 74 44 69 73 |l the Re|questDis|
|00002980| 70 61 74 63 68 65 72 20 | 69 73 20 64 65 6c 65 74 |patcher |is delet|
|00002990| 65 64 2c 20 69 2e 65 2e | 20 77 68 65 6e 20 74 68 |ed, i.e.| when th|
|000029a0| 65 20 74 6f 6f 6c 20 71 | 75 69 74 73 2e 0d 09 0d |e tool q|uits....|
|000029b0| 09 49 74 20 69 73 20 69 | 6d 70 6f 72 74 61 6e 74 |.It is i|mportant|
|000029c0| 20 74 6f 20 75 6e 64 65 | 72 73 74 61 6e 64 20 74 | to unde|rstand t|
|000029d0| 68 61 74 20 61 20 53 65 | 72 76 69 63 65 20 6f 62 |hat a Se|rvice ob|
|000029e0| 6a 65 63 74 20 69 73 20 | 2a 6e 6f 74 2a 20 63 72 |ject is |*not* cr|
|000029f0| 65 61 74 65 64 20 65 61 | 63 68 20 74 69 6d 65 20 |eated ea|ch time |
|00002a00| 61 20 73 63 72 69 70 74 | 20 6d 61 6b 65 73 20 61 |a script| makes a|
|00002a10| 20 73 65 72 76 69 63 65 | 20 63 61 6c 6c 2e 20 41 | service| call. A|
|00002a20| 20 52 65 71 75 65 73 74 | 20 6f 62 6a 65 63 74 20 | Request| object |
|00002a30| 63 6f 72 72 65 73 70 6f | 6e 64 73 20 74 6f 20 65 |correspo|nds to e|
|00002a40| 61 63 68 20 70 61 72 74 | 69 63 75 6c 61 72 20 69 |ach part|icular i|
|00002a50| 6e 73 74 61 6e 63 65 20 | 6f 66 20 61 20 73 65 72 |nstance |of a ser|
|00002a60| 76 69 63 65 20 63 61 6c | 6c 2c 20 6e 6f 74 20 61 |vice cal|l, not a|
|00002a70| 20 53 65 72 76 69 63 65 | 20 6f 62 6a 65 63 74 2e | Service| object.|
|00002a80| 0d 09 53 65 72 76 69 63 | 65 20 6f 62 6a 65 63 74 |..Servic|e object|
|00002a90| 73 20 63 6f 6e 74 61 69 | 6e 20 74 68 65 20 6e 61 |s contai|n the na|
|00002aa0| 6d 65 20 6f 66 20 74 68 | 65 20 73 65 72 76 69 63 |me of th|e servic|
|00002ab0| 65 20 61 73 20 61 20 6d | 65 6d 62 65 72 2e 20 54 |e as a m|ember. T|
|00002ac0| 68 69 73 20 69 73 20 75 | 73 65 64 20 62 79 20 74 |his is u|sed by t|
|00002ad0| 68 65 20 52 65 71 75 65 | 73 74 44 69 73 70 61 74 |he Reque|stDispat|
|00002ae0| 63 68 65 72 20 74 6f 20 | 6c 6f 63 61 74 65 20 74 |cher to |locate t|
|00002af0| 68 65 20 63 6f 72 72 65 | 63 74 20 73 65 72 76 69 |he corre|ct servi|
|00002b00| 63 65 20 74 6f 20 70 72 | 6f 63 65 73 73 20 61 20 |ce to pr|ocess a |
|00002b10| 52 65 71 75 65 73 74 2e | 20 54 77 6f 20 53 65 72 |Request.| Two Ser|
|00002b20| 76 69 63 65 20 6f 62 6a | 65 63 74 73 20 63 61 6e |vice obj|ects can|
|00002b30| 20 6e 6f 74 20 63 6f 6e | 74 61 69 6e 20 74 68 65 | not con|tain the|
|00002b40| 20 73 61 6d 65 20 6e 61 | 6d 65 2e 20 0d 09 54 68 | same na|me. ..Th|
|00002b50| 65 20 53 65 72 76 69 63 | 65 20 50 72 6f 63 65 73 |e Servic|e Proces|
|00002b60| 73 52 65 71 75 65 73 74 | 28 29 20 66 75 6e 63 74 |sRequest|() funct|
|00002b70| 69 6f 6e 20 69 73 20 74 | 68 65 20 61 63 74 75 61 |ion is t|he actua|
|00002b80| 6c 20 63 75 73 74 6f 6d | 20 63 6f 64 65 20 74 68 |l custom| code th|
|00002b90| 61 74 20 69 73 20 65 78 | 65 63 75 74 65 64 20 61 |at is ex|ecuted a|
|00002ba0| 73 20 61 20 72 65 73 75 | 6c 74 20 6f 66 20 61 6e |s a resu|lt of an|
|00002bb0| 20 65 78 74 65 72 6e 61 | 6c 20 74 6f 6f 6c 20 73 | externa|l tool s|
|00002bc0| 65 72 76 69 63 65 20 63 | 61 6c 6c 2e 20 54 68 65 |ervice c|all. The|
|00002bd0| 20 52 65 71 75 65 73 74 | 44 69 73 70 61 74 63 68 | Request|Dispatch|
|00002be0| 65 72 20 44 69 73 70 61 | 74 63 68 43 75 73 74 6f |er Dispa|tchCusto|
|00002bf0| 6d 52 65 71 75 65 73 74 | 28 29 20 70 61 73 73 65 |mRequest|() passe|
|00002c00| 73 20 61 20 52 65 71 75 | 65 73 74 20 6f 62 6a 65 |s a Requ|est obje|
|00002c10| 63 74 20 74 6f 20 50 72 | 6f 63 65 73 73 52 65 71 |ct to Pr|ocessReq|
|00002c20| 75 65 73 74 28 29 2c 20 | 77 68 69 63 68 20 65 78 |uest(), |which ex|
|00002c30| 74 72 61 63 74 73 20 74 | 68 65 20 70 61 72 61 6d |tracts t|he param|
|00002c40| 65 74 65 72 73 20 61 6e | 64 20 70 72 6f 63 65 73 |eters an|d proces|
|00002c50| 73 65 73 20 74 68 65 20 | 52 65 71 75 65 73 74 2e |ses the |Request.|
|00002c60| 0d 09 49 66 20 50 72 6f | 63 65 73 73 52 65 71 75 |..If Pro|cessRequ|
|00002c70| 65 73 74 28 29 20 74 61 | 6b 65 73 20 6d 6f 72 65 |est() ta|kes more|
|00002c80| 20 74 68 61 6e 20 61 20 | 66 65 77 20 73 65 63 6f | than a |few seco|
|00002c90| 6e 64 73 20 74 6f 20 65 | 78 65 63 75 74 65 2c 20 |nds to e|xecute, |
|00002ca0| 69 74 20 73 68 6f 75 6c | 64 20 62 65 20 73 74 72 |it shoul|d be str|
|00002cb0| 75 63 74 75 72 65 64 20 | 61 73 20 61 6e 20 61 73 |uctured |as an as|
|00002cc0| 79 6e 63 68 72 6f 6e 6f | 75 73 20 6c 6f 6f 70 20 |ynchrono|us loop |
|00002cd0| 74 6f 20 69 6d 70 6c 65 | 6d 65 6e 74 20 63 61 6e |to imple|ment can|
|00002ce0| 63 65 6c 69 6e 67 2e 20 | 54 68 65 20 6c 6f 6f 70 |celing. |The loop|
|00002cf0| 20 73 68 6f 75 6c 64 20 | 70 65 72 69 6f 64 69 63 | should |periodic|
|00002d00| 61 6c 6c 79 20 63 61 6c | 6c 20 74 68 65 20 53 65 |ally cal|l the Se|
|00002d10| 72 76 69 63 65 20 43 68 | 65 63 6b 46 6f 72 43 61 |rvice Ch|eckForCa|
|00002d20| 6e 63 65 6c 28 29 20 66 | 75 6e 63 74 69 6f 6e 2e |ncel() f|unction.|
|00002d30| 20 43 68 65 63 6b 46 6f | 72 43 61 6e 63 65 6c 28 | CheckFo|rCancel(|
|00002d40| 29 20 72 65 74 75 72 6e | 73 20 74 68 65 20 66 6c |) return|s the fl|
|00002d50| 61 67 20 69 6e 20 74 68 | 65 20 52 65 71 75 65 73 |ag in th|e Reques|
|00002d60| 74 20 6f 62 6a 65 63 74 | 20 77 68 69 63 68 20 6d |t object| which m|
|00002d70| 61 79 20 68 61 76 65 20 | 62 65 65 6e 20 73 65 74 |ay have |been set|
|00002d80| 20 62 79 20 43 61 6e 63 | 65 6c 54 68 69 73 52 65 | by Canc|elThisRe|
|00002d90| 71 75 65 73 74 28 29 2e | 20 49 66 20 74 68 65 20 |quest().| If the |
|00002da0| 66 6c 61 67 20 69 73 20 | 74 72 75 65 2c 20 74 68 |flag is |true, th|
|00002db0| 65 20 73 65 72 76 69 63 | 65 20 63 6f 64 65 20 73 |e servic|e code s|
|00002dc0| 68 6f 75 6c 64 20 63 6c | 65 61 6e 20 75 70 20 61 |hould cl|ean up a|
|00002dd0| 6e 64 20 72 65 74 75 72 | 6e 20 61 73 20 73 6f 6f |nd retur|n as soo|
|00002de0| 6e 20 61 73 20 70 6f 73 | 73 69 62 6c 65 2e 20 41 |n as pos|sible. A|
|00002df0| 73 20 62 65 66 6f 72 65 | 2c 20 74 68 65 20 52 65 |s before|, the Re|
|00002e00| 71 75 65 73 74 44 69 73 | 70 61 74 63 68 65 72 20 |questDis|patcher |
|00002e10| 63 61 6c 6c 73 20 52 65 | 71 75 65 73 74 49 73 44 |calls Re|questIsD|
|00002e20| 6f 6e 65 28 29 2e 0d 09 | 43 68 65 63 6b 46 6f 72 |one()...|CheckFor|
|00002e30| 43 61 6e 63 65 6c 28 29 | 20 61 6c 73 6f 20 63 61 |Cancel()| also ca|
|00002e40| 6c 6c 73 20 74 68 65 20 | 45 76 65 6e 74 20 4d 61 |lls the |Event Ma|
|00002e50| 6e 61 67 65 72 20 74 6f | 20 73 65 72 76 69 63 65 |nager to| service|
|00002e60| 20 61 6e 79 20 72 65 71 | 75 65 73 74 73 20 6f 72 | any req|uests or|
|00002e70| 20 65 76 65 6e 74 73 20 | 74 68 61 74 20 6d 61 79 | events |that may|
|00002e80| 20 6f 63 63 75 72 20 77 | 68 69 6c 65 20 74 68 65 | occur w|hile the|
|00002e90| 20 73 65 72 76 69 63 65 | 20 69 73 20 62 65 69 6e | service| is bein|
|00002ea0| 67 20 70 72 6f 63 65 73 | 73 65 64 2e 20 54 68 65 |g proces|sed. The|
|00002eb0| 73 65 20 69 6e 63 6c 75 | 64 65 20 6e 6f 72 6d 61 |se inclu|de norma|
|00002ec0| 6c 20 75 73 65 72 20 67 | 65 6e 65 72 61 74 65 64 |l user g|enerated|
|00002ed0| 20 65 76 65 6e 74 73 20 | 61 73 20 77 65 6c 6c 20 | events |as well |
|00002ee0| 61 73 20 41 70 70 6c 65 | 20 65 76 65 6e 74 73 2e |as Apple| events.|
|00002ef0| 20 41 6e 20 41 70 70 6c | 65 20 65 76 65 6e 74 20 | An Appl|e event |
|00002f00| 6d 69 67 68 74 20 63 6f | 6e 74 61 69 6e 20 61 6e |might co|ntain an|
|00002f10| 20 65 78 74 65 72 6e 61 | 6c 20 74 6f 6f 6c 20 73 | externa|l tool s|
|00002f20| 65 72 76 69 63 65 20 63 | 61 6c 6c 20 74 68 61 74 |ervice c|all that|
|00002f30| 20 69 73 20 70 6c 61 63 | 65 64 20 69 6e 74 6f 20 | is plac|ed into |
|00002f40| 74 68 65 20 70 65 6e 64 | 69 6e 67 20 72 65 71 75 |the pend|ing requ|
|00002f50| 65 73 74 20 71 75 65 75 | 65 2c 20 6f 72 20 61 20 |est queu|e, or a |
|00002f60| 63 61 6e 63 65 6c 20 72 | 65 71 75 65 73 74 20 66 |cancel r|equest f|
|00002f70| 6f 72 20 61 20 70 72 65 | 76 69 6f 75 73 20 73 65 |or a pre|vious se|
|00002f80| 72 76 69 63 65 20 63 61 | 6c 6c 2c 20 77 68 69 63 |rvice ca|ll, whic|
|00002f90| 68 20 69 73 20 70 72 6f | 63 65 73 73 65 64 20 69 |h is pro|cessed i|
|00002fa0| 6d 6d 65 64 69 61 74 65 | 6c 79 2e 0d 52 65 71 75 |mmediate|ly..Requ|
|00002fb0| 65 73 74 20 4f 62 6a 65 | 63 74 0d 09 41 20 52 65 |est Obje|ct..A Re|
|00002fc0| 71 75 65 73 74 20 6f 62 | 6a 65 63 74 20 69 73 20 |quest ob|ject is |
|00002fd0| 74 68 65 20 62 61 73 65 | 20 63 6c 61 73 73 20 74 |the base| class t|
|00002fe0| 6f 20 72 65 70 72 65 73 | 65 6e 74 20 6f 6e 65 20 |o repres|ent one |
|00002ff0| 70 61 72 74 69 63 75 6c | 61 72 20 73 65 72 76 69 |particul|ar servi|
|00003000| 63 65 20 63 61 6c 6c 20 | 66 72 6f 6d 20 61 20 73 |ce call |from a s|
|00003010| 63 72 69 70 74 2c 20 66 | 72 6f 6d 20 74 68 65 20 |cript, f|rom the |
|00003020| 70 6f 69 6e 74 20 6f 66 | 20 76 69 65 77 20 6f 66 |point of| view of|
|00003030| 20 74 68 65 20 63 6f 64 | 65 20 70 72 6f 63 65 73 | the cod|e proces|
|00003040| 73 69 6e 67 20 74 68 65 | 20 73 65 72 76 69 63 65 |sing the| service|
|00003050| 20 63 61 6c 6c 2e 20 41 | 20 52 65 71 75 65 73 74 | call. A| Request|
|00003060| 20 63 6f 6e 74 61 69 6e | 73 20 73 65 76 65 72 61 | contain|s severa|
|00003070| 6c 20 6d 65 6d 62 65 72 | 73 20 6e 65 63 65 73 73 |l member|s necess|
|00003080| 61 72 79 20 66 6f 72 20 | 68 61 6e 64 6c 69 6e 67 |ary for |handling|
|00003090| 20 61 20 73 65 72 76 69 | 63 65 20 63 61 6c 6c 3a | a servi|ce call:|
|000030a0| 20 74 68 65 20 69 6e 63 | 6f 6d 69 6e 67 20 73 65 | the inc|oming se|
|000030b0| 72 76 69 63 65 20 6e 61 | 6d 65 20 61 6e 64 20 70 |rvice na|me and p|
|000030c0| 61 72 61 6d 65 74 65 72 | 73 3b 20 74 68 65 20 6f |arameter|s; the o|
|000030d0| 75 74 67 6f 69 6e 67 20 | 65 72 72 6f 72 20 76 61 |utgoing |error va|
|000030e0| 6c 75 65 2c 20 72 65 74 | 75 72 6e 20 76 61 6c 75 |lue, ret|urn valu|
|000030f0| 65 2c 20 61 6e 64 20 65 | 72 72 6f 72 20 73 74 72 |e, and e|rror str|
|00003100| 69 6e 67 3b 20 74 68 65 | 20 69 64 65 6e 74 69 66 |ing; the| identif|
|00003110| 69 65 72 20 6f 66 20 74 | 68 65 20 72 65 71 75 65 |ier of t|he reque|
|00003120| 73 74 2c 20 63 6f 72 72 | 65 73 70 6f 6e 64 69 6e |st, corr|espondin|
|00003130| 67 20 74 6f 20 74 68 65 | 20 61 73 79 6e 63 68 72 |g to the| asynchr|
|00003140| 6f 6e 6f 75 73 20 6a 6f | 62 20 69 64 65 6e 74 69 |onous jo|b identi|
|00003150| 66 69 65 72 20 69 6e 20 | 74 68 65 20 56 55 20 73 |fier in |the VU s|
|00003160| 63 72 69 70 74 3b 20 61 | 20 66 6c 61 67 20 69 6e |cript; a| flag in|
|00003170| 64 69 63 61 74 69 6e 67 | 20 77 68 65 74 68 65 72 |dicating| whether|
|00003180| 20 74 68 69 73 20 73 65 | 72 76 69 63 65 20 63 61 | this se|rvice ca|
|00003190| 6c 6c 20 68 61 73 20 62 | 65 65 6e 20 63 61 6e 63 |ll has b|een canc|
|000031a0| 65 6c 65 64 3b 20 61 6e | 64 20 74 68 65 20 76 61 |eled; an|d the va|
|000031b0| 6c 75 65 20 54 69 63 6b | 43 6f 75 6e 74 28 29 20 |lue Tick|Count() |
|000031c0| 77 69 6c 6c 20 62 65 20 | 74 68 65 20 6e 65 78 74 |will be |the next|
|000031d0| 20 74 69 6d 65 20 74 68 | 65 20 74 6f 6f 6c 20 6e | time th|e tool n|
|000031e0| 65 65 64 73 20 74 6f 20 | 72 65 71 75 65 73 74 20 |eeds to |request |
|000031f0| 6d 6f 72 65 20 74 69 6d | 65 20 74 6f 20 63 6f 6d |more tim|e to com|
|00003200| 70 6c 65 74 65 20 74 68 | 65 20 73 65 72 76 69 63 |plete th|e servic|
|00003210| 65 20 63 61 6c 6c 20 66 | 72 6f 6d 20 56 55 2e 20 |e call f|rom VU. |
|00003220| 0d 09 41 20 6e 65 77 20 | 52 65 71 75 65 73 74 20 |..A new |Request |
|00003230| 6f 62 6a 65 63 74 20 69 | 73 20 63 72 65 61 74 65 |object i|s create|
|00003240| 64 20 62 79 20 74 68 65 | 20 41 70 70 6c 65 20 65 |d by the| Apple e|
|00003250| 76 65 6e 74 20 68 61 6e | 64 6c 65 72 20 66 6f 72 |vent han|dler for|
|00003260| 20 27 76 2e 75 2e 27 20 | 65 76 65 6e 74 73 20 65 | 'v.u.' |events e|
|00003270| 61 63 68 20 74 69 6d 65 | 20 61 20 73 63 72 69 70 |ach time| a scrip|
|00003280| 74 20 6d 61 6b 65 73 20 | 61 20 73 65 72 76 69 63 |t makes |a servic|
|00003290| 65 20 63 61 6c 6c 20 74 | 6f 20 74 68 65 20 74 6f |e call t|o the to|
|000032a0| 6f 6c 2e 20 41 63 74 75 | 61 6c 6c 79 2c 20 74 68 |ol. Actu|ally, th|
|000032b0| 65 20 68 61 6e 64 6c 65 | 72 20 63 72 65 61 74 65 |e handle|r create|
|000032c0| 73 20 61 20 6e 65 77 20 | 41 45 52 65 71 75 65 73 |s a new |AEReques|
|000032d0| 74 20 6f 62 6a 65 63 74 | 2c 20 62 75 74 20 74 68 |t object|, but th|
|000032e0| 65 20 52 65 71 75 65 73 | 74 20 63 6c 61 73 73 20 |e Reques|t class |
|000032f0| 69 73 20 74 68 65 20 70 | 61 72 65 6e 74 20 6f 66 |is the p|arent of|
|00003300| 20 74 68 65 20 41 45 52 | 65 71 75 65 73 74 20 63 | the AER|equest c|
|00003310| 6c 61 73 73 2c 20 61 6e | 64 20 74 68 65 20 52 65 |lass, an|d the Re|
|00003320| 71 75 65 73 74 44 69 73 | 70 61 74 63 68 65 72 20 |questDis|patcher |
|00003330| 6f 6e 6c 79 20 68 61 73 | 20 61 63 63 65 73 73 20 |only has| access |
|00003340| 74 6f 20 52 65 71 75 65 | 73 74 20 6f 62 6a 65 63 |to Reque|st objec|
|00003350| 74 73 2e 20 54 68 65 20 | 52 65 71 75 65 73 74 20 |ts. The |Request |
|00003360| 69 73 20 70 72 6f 63 65 | 73 73 65 64 20 61 73 20 |is proce|ssed as |
|00003370| 64 65 73 63 72 69 62 65 | 64 20 69 6e 20 74 68 65 |describe|d in the|
|00003380| 20 70 72 65 76 69 6f 75 | 73 20 73 65 63 74 69 6f | previou|s sectio|
|00003390| 6e 73 2c 20 74 68 65 6e | 20 64 65 6c 65 74 65 64 |ns, then| deleted|
|000033a0| 20 62 79 20 74 68 65 20 | 52 65 71 75 65 73 74 44 | by the |RequestD|
|000033b0| 69 73 70 61 74 63 68 65 | 72 2e 0d 09 4d 6f 73 74 |ispatche|r...Most|
|000033c0| 20 6f 66 20 74 68 65 20 | 66 75 6e 63 74 69 6f 6e | of the |function|
|000033d0| 73 20 66 6f 72 20 52 65 | 71 75 65 73 74 20 6f 62 |s for Re|quest ob|
|000033e0| 6a 65 63 74 73 20 61 6c | 6c 6f 77 20 61 63 63 65 |jects al|low acce|
|000033f0| 73 73 20 74 6f 20 74 68 | 65 20 64 61 74 61 20 6d |ss to th|e data m|
|00003400| 65 6d 62 65 72 73 2e 20 | 53 6f 6d 65 20 6f 66 20 |embers. |Some of |
|00003410| 74 68 65 6d 20 61 72 65 | 20 76 69 72 74 75 61 6c |them are| virtual|
|00003420| 20 66 75 6e 63 74 69 6f | 6e 73 20 72 65 64 65 63 | functio|ns redec|
|00003430| 6c 61 72 65 64 20 69 6e | 20 74 68 65 20 41 45 52 |lared in| the AER|
|00003440| 65 71 75 65 73 74 20 6f | 62 6a 65 63 74 2e 20 54 |equest o|bject. T|
|00003450| 68 65 73 65 20 61 6c 6c | 6f 77 20 74 68 65 20 52 |hese all|ow the R|
|00003460| 65 71 75 65 73 74 44 69 | 73 70 61 74 63 68 65 72 |equestDi|spatcher|
|00003470| 20 74 6f 20 70 65 72 66 | 6f 72 6d 20 41 70 70 6c | to perf|orm Appl|
|00003480| 65 20 65 76 65 6e 74 20 | 61 63 74 69 6f 6e 73 20 |e event |actions |
|00003490| 77 69 74 68 6f 75 74 20 | 68 61 76 69 6e 67 20 74 |without |having t|
|000034a0| 6f 20 6b 6e 6f 77 20 61 | 62 6f 75 74 20 41 45 52 |o know a|bout AER|
|000034b0| 65 71 75 65 73 74 20 6f | 62 6a 65 63 74 73 20 6f |equest o|bjects o|
|000034c0| 72 20 74 68 65 69 72 20 | 61 73 73 6f 63 69 61 74 |r their |associat|
|000034d0| 65 64 20 41 70 70 6c 65 | 20 65 76 65 6e 74 73 2e |ed Apple| events.|
|000034e0| 20 54 77 6f 20 65 78 61 | 6d 70 6c 65 73 20 61 72 | Two exa|mples ar|
|000034f0| 65 20 52 65 73 65 74 54 | 69 6d 65 4f 75 74 43 6f |e ResetT|imeOutCo|
|00003500| 75 6e 74 65 72 28 29 20 | 61 6e 64 20 53 65 6e 64 |unter() |and Send|
|00003510| 52 65 73 75 6c 74 28 29 | 2e 0d 41 45 52 65 71 75 |Result()|..AERequ|
|00003520| 65 73 74 20 4f 62 6a 65 | 63 74 0d 09 41 6e 20 41 |est Obje|ct..An A|
|00003530| 45 52 65 71 75 65 73 74 | 20 6f 62 6a 65 63 74 20 |ERequest| object |
|00003540| 69 73 20 61 20 63 68 69 | 6c 64 20 6f 66 20 74 68 |is a chi|ld of th|
|00003550| 65 20 52 65 71 75 65 73 | 74 20 63 6c 61 73 73 2c |e Reques|t class,|
|00003560| 20 61 6e 64 20 72 65 70 | 72 65 73 65 6e 74 73 20 | and rep|resents |
|00003570| 74 68 65 20 61 64 64 69 | 74 69 6f 6e 61 6c 20 69 |the addi|tional i|
|00003580| 6e 66 6f 72 6d 61 74 69 | 6f 6e 20 75 73 65 64 20 |nformati|on used |
|00003590| 62 79 20 74 68 65 20 41 | 70 70 6c 65 20 45 76 65 |by the A|pple Eve|
|000035a0| 6e 74 20 4d 61 6e 61 67 | 65 72 2e 20 41 6e 20 41 |nt Manag|er. An A|
|000035b0| 45 52 65 71 75 65 73 74 | 20 63 6f 6e 74 61 69 6e |ERequest| contain|
|000035c0| 73 20 73 65 76 65 72 61 | 6c 20 6d 65 6d 62 65 72 |s severa|l member|
|000035d0| 73 20 6e 65 63 65 73 73 | 61 72 79 20 66 6f 72 20 |s necess|ary for |
|000035e0| 68 61 6e 64 6c 69 6e 67 | 20 61 6e 20 41 70 70 6c |handling| an Appl|
|000035f0| 65 20 65 76 65 6e 74 3a | 20 61 20 70 6f 69 6e 74 |e event:| a point|
|00003600| 65 72 20 74 6f 20 74 68 | 65 20 69 6e 63 6f 6d 69 |er to th|e incomi|
|00003610| 6e 67 20 41 70 70 6c 65 | 20 65 76 65 6e 74 2c 20 |ng Apple| event, |
|00003620| 6f 72 20 6d 65 73 73 61 | 67 65 3b 20 61 20 70 6f |or messa|ge; a po|
|00003630| 69 6e 74 65 72 20 74 6f | 20 74 68 65 20 6f 75 74 |inter to| the out|
|00003640| 67 6f 69 6e 67 20 72 65 | 70 6c 79 20 41 70 70 6c |going re|ply Appl|
|00003650| 65 20 65 76 65 6e 74 3b | 20 61 20 66 6c 61 67 20 |e event;| a flag |
|00003660| 69 6e 64 69 63 61 74 69 | 6e 67 20 69 66 20 74 68 |indicati|ng if th|
|00003670| 65 20 41 70 70 6c 65 20 | 65 76 65 6e 74 20 68 61 |e Apple |event ha|
|00003680| 73 20 62 65 65 6e 20 73 | 75 73 70 65 6e 64 65 64 |s been s|uspended|
|00003690| 3b 20 61 6e 64 20 61 20 | 74 65 6d 70 6c 61 74 65 |; and a |template|
|000036a0| 20 6f 66 20 74 68 65 20 | 41 70 70 6c 65 20 65 76 | of the |Apple ev|
|000036b0| 65 6e 74 20 75 73 65 64 | 20 74 6f 20 61 73 6b 20 |ent used| to ask |
|000036c0| 56 55 20 66 6f 72 20 6d | 6f 72 65 20 74 69 6d 65 |VU for m|ore time|
|000036d0| 2e 20 0d 09 41 20 6e 65 | 77 20 41 45 52 65 71 75 |. ..A ne|w AERequ|
|000036e0| 65 73 74 20 6f 62 6a 65 | 63 74 20 69 73 20 63 72 |est obje|ct is cr|
|000036f0| 65 61 74 65 64 20 62 79 | 20 74 68 65 20 41 70 70 |eated by| the App|
|00003700| 6c 65 20 65 76 65 6e 74 | 20 68 61 6e 64 6c 65 72 |le event| handler|
|00003710| 20 66 6f 72 20 27 76 2e | 75 2e 27 20 65 76 65 6e | for 'v.|u.' even|
|00003720| 74 73 20 65 61 63 68 20 | 74 69 6d 65 20 61 20 73 |ts each |time a s|
|00003730| 63 72 69 70 74 20 6d 61 | 6b 65 73 20 61 20 73 65 |cript ma|kes a se|
|00003740| 72 76 69 63 65 20 63 61 | 6c 6c 20 74 6f 20 74 68 |rvice ca|ll to th|
|00003750| 65 20 74 6f 6f 6c 2e 20 | 49 66 20 69 74 20 69 73 |e tool. |If it is|
|00003760| 20 6e 6f 74 20 61 20 63 | 61 6e 63 65 6c 20 72 65 | not a c|ancel re|
|00003770| 71 75 65 73 74 2c 20 74 | 68 65 20 68 61 6e 64 6c |quest, t|he handl|
|00003780| 65 72 20 63 61 6c 6c 73 | 20 69 74 73 20 49 6e 69 |er calls| its Ini|
|00003790| 74 69 61 6c 69 7a 65 28 | 29 20 66 75 6e 63 74 69 |tialize(|) functi|
|000037a0| 6f 6e 20 61 6e 64 20 70 | 6c 61 63 65 73 20 69 74 |on and p|laces it|
|000037b0| 20 69 6e 74 6f 20 74 68 | 65 20 70 65 6e 64 69 6e | into th|e pendin|
|000037c0| 67 20 72 65 71 75 65 73 | 74 20 71 75 65 75 65 2e |g reques|t queue.|
|000037d0| 20 41 66 74 65 72 20 74 | 68 69 73 20 70 6f 69 6e | After t|his poin|
|000037e0| 74 20 74 68 65 20 41 45 | 52 65 71 75 65 73 74 20 |t the AE|Request |
|000037f0| 6d 65 6d 62 65 72 20 66 | 75 6e 63 74 69 6f 6e 73 |member f|unctions|
|00003800| 20 61 72 65 20 61 63 63 | 65 73 73 65 64 20 6f 6e | are acc|essed on|
|00003810| 6c 79 20 74 68 72 6f 75 | 67 68 20 74 68 65 20 76 |ly throu|gh the v|
|00003820| 69 72 74 75 61 6c 20 66 | 75 6e 63 74 69 6f 6e 73 |irtual f|unctions|
|00003830| 20 69 6e 20 74 68 65 20 | 52 65 71 75 65 73 74 20 | in the |Request |
|00003840| 63 6c 61 73 73 2e 0d 09 | 54 68 65 20 64 65 73 74 |class...|The dest|
|00003850| 72 75 63 74 6f 72 20 66 | 6f 72 20 61 6e 20 41 45 |ructor f|or an AE|
|00003860| 52 65 71 75 65 73 74 20 | 64 69 73 70 6f 73 65 73 |Request |disposes|
|00003870| 20 6f 66 20 69 74 73 20 | 6d 65 73 73 61 67 65 20 | of its |message |
|00003880| 61 6e 64 20 72 65 70 6c | 79 20 41 70 70 6c 65 20 |and repl|y Apple |
|00003890| 65 76 65 6e 74 73 20 69 | 66 20 74 68 65 20 6d 65 |events i|f the me|
|000038a0| 73 73 61 67 65 20 77 61 | 73 20 73 75 73 70 65 6e |ssage wa|s suspen|
|000038b0| 64 65 64 20 61 6e 64 20 | 6e 6f 74 20 72 65 73 75 |ded and |not resu|
|000038c0| 6d 65 64 2e 20 49 66 20 | 74 68 65 20 6d 65 73 73 |med. If |the mess|
|000038d0| 61 67 65 20 77 61 73 20 | 6e 6f 74 20 73 75 73 70 |age was |not susp|
|000038e0| 65 6e 64 65 64 2c 20 69 | 74 20 77 61 73 20 64 65 |ended, i|t was de|
|000038f0| 6c 65 74 65 64 20 62 79 | 20 74 68 65 20 41 70 70 |leted by| the App|
|00003900| 6c 65 20 45 76 65 6e 74 | 20 4d 61 6e 61 67 65 72 |le Event| Manager|
|00003910| 20 77 68 65 6e 20 74 68 | 65 20 68 61 6e 64 6c 65 | when th|e handle|
|00003920| 72 20 72 65 74 75 72 6e | 65 64 2e 20 49 66 20 69 |r return|ed. If i|
|00003930| 74 20 77 61 73 20 73 75 | 73 70 65 6e 64 65 64 20 |t was su|spended |
|00003940| 61 6e 64 20 6c 61 74 65 | 72 20 72 65 73 75 6d 65 |and late|r resume|
|00003950| 64 20 77 69 74 68 6f 75 | 74 20 61 20 68 61 6e 64 |d withou|t a hand|
|00003960| 6c 65 72 2c 20 69 74 20 | 77 61 73 20 64 65 6c 65 |ler, it |was dele|
|00003970| 74 65 64 20 62 79 20 74 | 68 65 20 41 70 70 6c 65 |ted by t|he Apple|
|00003980| 20 45 76 65 6e 74 20 4d | 61 6e 61 67 65 72 2e 20 | Event M|anager. |
|00003990| 54 68 65 20 64 65 73 74 | 72 75 63 74 6f 72 20 61 |The dest|ructor a|
|000039a0| 6c 73 6f 20 64 65 6c 65 | 74 65 73 20 74 68 65 20 |lso dele|tes the |
|000039b0| 22 72 65 71 75 65 73 74 | 20 66 6f 72 20 6d 6f 72 |"request| for mor|
|000039c0| 65 20 74 69 6d 65 22 20 | 41 70 70 6c 65 45 76 65 |e time" |AppleEve|
|000039d0| 6e 74 2e 0d 53 63 72 69 | 70 74 56 61 6c 75 65 20 |nt..Scri|ptValue |
|000039e0| 4f 62 6a 65 63 74 0d 09 | 54 68 65 20 53 63 72 69 |Object..|The Scri|
|000039f0| 70 74 56 61 6c 75 65 20 | 6f 62 6a 65 63 74 20 72 |ptValue |object r|
|00003a00| 65 70 72 65 73 65 6e 74 | 73 20 73 65 72 76 69 63 |epresent|s servic|
|00003a10| 65 20 63 61 6c 6c 20 70 | 61 72 61 6d 65 74 65 72 |e call p|arameter|
|00003a20| 73 20 69 6e 20 61 20 77 | 61 79 20 74 68 61 74 20 |s in a w|ay that |
|00003a30| 69 73 20 63 6f 6e 63 65 | 70 74 75 61 6c 6c 79 20 |is conce|ptually |
|00003a40| 73 69 6d 69 6c 61 72 20 | 74 6f 20 74 68 65 20 74 |similar |to the t|
|00003a50| 79 70 65 73 20 61 76 61 | 69 6c 61 62 6c 65 20 69 |ypes ava|ilable i|
|00003a60| 6e 20 56 69 72 74 75 61 | 6c 20 55 73 65 72 20 61 |n Virtua|l User a|
|00003a70| 6e 64 20 41 70 70 6c 65 | 20 53 63 72 69 70 74 2e |nd Apple| Script.|
|00003a80| 20 54 68 65 20 62 61 73 | 69 63 20 69 64 65 61 20 | The bas|ic idea |
|00003a90| 69 73 20 74 68 61 74 20 | 6f 6e 65 20 6d 65 6d 62 |is that |one memb|
|00003aa0| 65 72 20 63 6f 6e 74 61 | 69 6e 73 20 74 68 65 20 |er conta|ins the |
|00003ab0| 76 61 6c 75 65 20 69 74 | 73 65 6c 66 2c 20 61 6e |value it|self, an|
|00003ac0| 64 20 61 6e 6f 74 68 65 | 72 20 6d 65 6d 62 65 72 |d anothe|r member|
|00003ad0| 20 63 6f 6e 74 61 69 6e | 73 20 74 68 65 20 74 79 | contain|s the ty|
|00003ae0| 70 65 20 6f 66 20 74 68 | 65 20 76 61 6c 75 65 2e |pe of th|e value.|
|00003af0| 20 54 68 65 20 41 45 52 | 65 71 75 65 73 74 20 49 | The AER|equest I|
|00003b00| 6e 69 74 69 61 6c 69 7a | 65 28 29 20 66 75 6e 63 |nitializ|e() func|
|00003b10| 74 69 6f 6e 20 63 6f 70 | 69 65 73 20 74 68 65 20 |tion cop|ies the |
|00003b20| 73 65 72 76 69 63 65 20 | 63 61 6c 6c 20 70 61 72 |service |call par|
|00003b30| 61 6d 65 74 65 72 73 20 | 66 72 6f 6d 20 74 68 65 |ameters |from the|
|00003b40| 20 41 70 70 6c 65 20 65 | 76 65 6e 74 20 6d 65 73 | Apple e|vent mes|
|00003b50| 73 61 67 65 20 28 77 68 | 65 72 65 20 74 68 65 79 |sage (wh|ere they|
|00003b60| 20 72 65 73 69 64 65 20 | 61 73 20 61 6e 20 41 45 | reside |as an AE|
|00003b70| 44 65 73 63 4c 69 73 74 | 29 20 69 6e 74 6f 20 74 |DescList|) into t|
|00003b80| 68 65 20 53 63 72 69 70 | 74 56 61 6c 75 65 20 6d |he Scrip|tValue m|
|00003b90| 65 6d 62 65 72 20 6f 66 | 20 74 68 65 20 52 65 71 |ember of| the Req|
|00003ba0| 75 65 73 74 20 62 61 73 | 65 20 6f 62 6a 65 63 74 |uest bas|e object|
|00003bb0| 20 28 77 68 65 72 65 20 | 74 68 65 79 20 61 72 65 | (where |they are|
|00003bc0| 20 61 63 63 65 73 73 69 | 62 6c 65 20 74 6f 20 74 | accessi|ble to t|
|00003bd0| 68 65 20 53 65 72 76 69 | 63 65 20 50 72 6f 63 65 |he Servi|ce Proce|
|00003be0| 73 73 52 65 71 75 65 73 | 74 28 29 20 66 75 6e 63 |ssReques|t() func|
|00003bf0| 74 69 6f 6e 20 74 68 72 | 6f 75 67 68 20 76 61 72 |tion thr|ough var|
|00003c00| 69 6f 75 73 20 6d 65 6d | 62 65 72 20 66 75 6e 63 |ious mem|ber func|
|00003c10| 74 69 6f 6e 73 29 2e 0d | 09 54 68 65 20 53 63 72 |tions)..|.The Scr|
|00003c20| 69 70 74 56 61 6c 75 65 | 20 63 6c 61 73 73 20 68 |iptValue| class h|
|00003c30| 61 73 20 75 6e 64 65 72 | 67 6f 6e 65 20 65 78 74 |as under|gone ext|
|00003c40| 65 6e 73 69 76 65 20 72 | 65 64 65 73 69 67 6e 20 |ensive r|edesign |
|00003c50| 61 6e 64 20 49 20 64 6f | 6e 27 74 20 6b 6e 6f 77 |and I do|n't know|
|00003c60| 20 68 6f 77 20 69 74 20 | 77 6f 72 6b 73 20 79 65 | how it |works ye|
|00003c70| 74 2e 20 54 68 69 73 20 | 63 6c 61 73 73 20 69 73 |t. This |class is|
|00003c80| 20 69 6e 63 69 64 65 6e | 74 61 6c 20 74 6f 20 74 | inciden|tal to t|
|00003c90| 68 65 20 62 61 73 69 63 | 20 6f 70 65 72 61 74 69 |he basic| operati|
|00003ca0| 6f 6e 20 6f 66 20 74 68 | 65 20 74 6f 6f 6c 2c 20 |on of th|e tool, |
|00003cb0| 77 68 65 74 68 65 72 20 | 74 68 72 65 61 64 69 6e |whether |threadin|
|00003cc0| 67 20 69 73 20 65 6e 61 | 62 6c 65 64 20 6f 72 20 |g is ena|bled or |
|00003cd0| 6e 6f 74 2e 20 49 74 20 | 69 73 20 61 20 6c 61 79 |not. It |is a lay|
|00003ce0| 65 72 20 62 75 69 6c 74 | 20 6f 6e 20 74 6f 70 20 |er built| on top |
|00003cf0| 6f 66 20 74 68 65 20 62 | 61 73 69 63 20 74 79 70 |of the b|asic typ|
|00003d00| 65 73 20 73 65 74 20 66 | 72 6f 6d 20 61 20 73 63 |es set f|rom a sc|
|00003d10| 72 69 70 74 2c 20 61 6e | 64 20 69 73 20 6e 6f 74 |ript, an|d is not|
|00003d20| 20 69 6e 76 6f 6c 76 65 | 64 20 69 6e 20 74 68 65 | involve|d in the|
|00003d30| 20 6d 65 63 68 61 6e 69 | 63 73 20 6f 66 20 41 70 | mechani|cs of Ap|
|00003d40| 70 6c 65 20 65 76 65 6e | 74 73 20 6f 72 20 72 65 |ple even|ts or re|
|00003d50| 71 75 65 73 74 20 64 69 | 73 70 61 74 63 68 69 6e |quest di|spatchin|
|00003d60| 67 2e 20 0d 09 43 68 61 | 70 74 65 72 20 32 09 41 |g. ..Cha|pter 2.A|
|00003d70| 64 64 69 6e 67 20 43 6f | 6f 70 65 72 61 74 69 76 |dding Co|operativ|
|00003d80| 65 20 54 68 72 65 61 64 | 73 0d 54 68 69 73 20 63 |e Thread|s.This c|
|00003d90| 68 61 70 74 65 72 20 64 | 65 73 63 72 69 62 65 73 |hapter d|escribes|
|00003da0| 20 68 6f 77 20 63 6f 6f | 70 65 72 61 74 69 76 65 | how coo|perative|
|00003db0| 20 74 68 72 65 61 64 73 | 20 61 72 65 20 69 6d 70 | threads| are imp|
|00003dc0| 6c 65 6d 65 6e 74 65 64 | 20 69 6e 20 74 68 65 20 |lemented| in the |
|00003dd0| 32 2e 31 20 74 65 6d 70 | 6c 61 74 65 2e 20 53 69 |2.1 temp|late. Si|
|00003de0| 6e 63 65 20 74 68 65 20 | 6e 6f 6e 2d 74 68 72 65 |nce the |non-thre|
|00003df0| 61 64 65 64 20 6d 6f 64 | 65 6c 20 6e 65 65 64 73 |aded mod|el needs|
|00003e00| 20 6f 6e 6c 79 20 6d 69 | 6e 6f 72 20 63 68 61 6e | only mi|nor chan|
|00003e10| 67 65 73 2c 20 74 68 69 | 73 20 63 68 61 70 74 65 |ges, thi|s chapte|
|00003e20| 72 20 69 73 20 6f 72 67 | 61 6e 69 7a 65 64 20 61 |r is org|anized a|
|00003e30| 73 20 61 20 73 65 72 69 | 65 73 20 6f 66 20 6d 6f |s a seri|es of mo|
|00003e40| 64 69 66 69 63 61 74 69 | 6f 6e 73 20 74 6f 20 74 |dificati|ons to t|
|00003e50| 68 65 20 6f 72 69 67 69 | 6e 61 6c 20 6f 62 6a 65 |he origi|nal obje|
|00003e60| 63 74 73 2e 0d 42 65 66 | 6f 72 65 20 72 65 61 64 |cts..Bef|ore read|
|00003e70| 69 6e 67 20 74 68 69 73 | 20 63 68 61 70 74 65 72 |ing this| chapter|
|00003e80| 2c 20 79 6f 75 20 73 68 | 6f 75 6c 64 20 62 65 20 |, you sh|ould be |
|00003e90| 66 61 6d 69 6c 69 61 72 | 20 77 69 74 68 20 74 68 |familiar| with th|
|00003ea0| 65 20 54 68 72 65 61 64 | 20 4d 61 6e 61 67 65 72 |e Thread| Manager|
|00003eb0| 20 65 78 74 65 6e 73 69 | 6f 6e 20 76 65 72 73 69 | extensi|on versi|
|00003ec0| 6f 6e 20 32 2e 30 2e 31 | 20 6f 72 20 6c 61 74 65 |on 2.0.1| or late|
|00003ed0| 72 2e 20 59 6f 75 20 73 | 68 6f 75 6c 64 20 75 6e |r. You s|hould un|
|00003ee0| 64 65 72 73 74 61 6e 64 | 20 74 68 65 20 6e 6f 6e |derstand| the non|
|00003ef0| 2d 74 68 72 65 61 64 65 | 64 20 56 55 20 65 78 74 |-threade|d VU ext|
|00003f00| 65 72 6e 61 6c 20 74 6f | 6f 6c 20 6d 6f 64 65 6c |ernal to|ol model|
|00003f10| 20 61 6e 64 20 69 74 73 | 20 70 72 69 6d 61 72 79 | and its| primary|
|00003f20| 20 6f 62 6a 65 63 74 73 | 2e 0d 4f 76 65 72 76 69 | objects|..Overvi|
|00003f30| 65 77 0d 09 54 68 65 20 | 54 68 72 65 61 64 20 4d |ew..The |Thread M|
|00003f40| 61 6e 61 67 65 72 20 69 | 73 20 61 6e 20 65 61 73 |anager i|s an eas|
|00003f50| 79 20 77 61 79 20 74 6f | 20 62 72 69 6e 67 20 74 |y way to| bring t|
|00003f60| 68 65 20 61 64 76 61 6e | 74 61 67 65 73 20 6f 66 |he advan|tages of|
|00003f70| 20 63 6f 6f 70 65 72 61 | 74 69 76 65 20 63 6f 6e | coopera|tive con|
|00003f80| 63 75 72 72 65 6e 74 20 | 70 72 6f 63 65 73 73 69 |current |processi|
|00003f90| 6e 67 20 74 6f 20 74 68 | 65 20 77 6f 72 6c 64 20 |ng to th|e world |
|00003fa0| 6f 66 20 56 55 20 65 78 | 74 65 72 6e 61 6c 20 74 |of VU ex|ternal t|
|00003fb0| 6f 6f 6c 73 2e 20 4a 75 | 73 74 20 61 73 20 74 68 |ools. Ju|st as th|
|00003fc0| 65 20 32 2e 30 20 74 65 | 6d 70 6c 61 74 65 20 61 |e 2.0 te|mplate a|
|00003fd0| 6c 6c 6f 77 73 20 61 20 | 64 65 73 69 67 6e 65 72 |llows a |designer|
|00003fe0| 20 74 6f 20 69 67 6e 6f | 72 65 20 74 68 65 20 6d | to igno|re the m|
|00003ff0| 65 63 68 61 6e 69 63 73 | 20 6f 66 20 41 70 70 6c |echanics| of Appl|
|00004000| 65 20 65 76 65 6e 74 73 | 20 61 6e 64 20 66 6f 63 |e events| and foc|
|00004010| 75 73 20 6f 6e 20 74 68 | 65 20 72 65 61 6c 20 63 |us on th|e real c|
|00004020| 6f 64 65 2c 20 74 68 65 | 20 32 2e 31 20 74 65 6d |ode, the| 2.1 tem|
|00004030| 70 6c 61 74 65 20 61 6c | 6c 6f 77 73 20 61 20 64 |plate al|lows a d|
|00004040| 65 73 69 67 6e 65 72 20 | 74 6f 20 69 67 6e 6f 72 |esigner |to ignor|
|00004050| 65 20 74 68 65 20 6d 65 | 63 68 61 6e 69 63 73 20 |e the me|chanics |
|00004060| 6f 66 20 74 68 72 65 61 | 64 69 6e 67 2c 20 77 68 |of threa|ding, wh|
|00004070| 69 6c 65 20 74 61 6b 69 | 6e 67 20 66 75 6c 6c 20 |ile taki|ng full |
|00004080| 61 64 76 61 6e 74 61 67 | 65 20 6f 66 20 74 68 65 |advantag|e of the|
|00004090| 20 61 64 64 69 74 69 6f | 6e 61 6c 20 63 61 70 61 | additio|nal capa|
|000040a0| 62 69 6c 69 74 69 65 73 | 2e 20 54 68 65 20 64 65 |bilities|. The de|
|000040b0| 73 69 67 6e 65 72 20 69 | 73 20 6e 6f 74 20 72 65 |signer i|s not re|
|000040c0| 71 75 69 72 65 64 20 74 | 6f 20 77 72 69 74 65 20 |quired t|o write |
|000040d0| 61 6e 79 20 61 64 64 69 | 74 69 6f 6e 61 6c 20 63 |any addi|tional c|
|000040e0| 6f 64 65 20 74 6f 20 69 | 6d 70 6c 65 6d 65 6e 74 |ode to i|mplement|
|000040f0| 20 61 20 74 68 72 65 61 | 64 65 64 20 73 65 72 76 | a threa|ded serv|
|00004100| 69 63 65 3b 20 69 6e 20 | 74 68 65 20 76 61 73 74 |ice; in |the vast|
|00004110| 20 6d 61 6a 6f 72 69 74 | 79 20 6f 66 20 63 61 73 | majorit|y of cas|
|00004120| 65 73 20 74 68 65 20 73 | 61 6d 65 20 63 6f 64 65 |es the s|ame code|
|00004130| 20 63 61 6e 20 62 65 20 | 75 73 65 64 20 69 6e 20 | can be |used in |
|00004140| 61 20 74 68 72 65 61 64 | 65 64 20 6f 72 20 6e 6f |a thread|ed or no|
|00004150| 6e 2d 74 68 72 65 61 64 | 65 64 20 73 65 72 76 69 |n-thread|ed servi|
|00004160| 63 65 2e 0d 09 50 72 65 | 65 6d 70 74 69 76 65 20 |ce...Pre|emptive |
|00004170| 74 68 72 65 61 64 73 20 | 61 72 65 20 6e 6f 74 20 |threads |are not |
|00004180| 73 75 70 70 6f 72 74 65 | 64 20 69 6e 20 74 68 65 |supporte|d in the|
|00004190| 20 32 2e 31 20 74 65 6d | 70 6c 61 74 65 2c 20 65 | 2.1 tem|plate, e|
|000041a0| 69 74 68 65 72 20 65 78 | 70 6c 69 63 69 74 6c 79 |ither ex|plicitly|
|000041b0| 20 6f 72 20 69 6d 70 6c | 69 63 69 74 6c 79 2e 20 | or impl|icitly. |
|000041c0| 49 6e 20 66 61 63 74 2c | 20 61 6c 6d 6f 73 74 20 |In fact,| almost |
|000041d0| 6e 6f 20 74 69 6d 65 20 | 77 68 61 74 73 6f 65 76 |no time |whatsoev|
|000041e0| 65 72 20 77 61 73 20 73 | 70 65 6e 74 20 63 6f 6e |er was s|pent con|
|000041f0| 73 69 64 65 72 69 6e 67 | 20 70 72 65 65 6d 70 74 |sidering| preempt|
|00004200| 69 6f 6e 20 64 75 72 69 | 6e 67 20 74 68 69 73 20 |ion duri|ng this |
|00004210| 64 65 73 69 67 6e 2e 20 | 54 68 65 20 50 6f 77 65 |design. |The Powe|
|00004220| 72 50 43 20 69 6d 70 6c | 65 6d 65 6e 74 61 74 69 |rPC impl|ementati|
|00004230| 6f 6e 20 6f 66 20 74 68 | 65 20 54 68 72 65 61 64 |on of th|e Thread|
|00004240| 20 4d 61 6e 61 67 65 72 | 20 64 6f 65 73 20 6e 6f | Manager| does no|
|00004250| 74 20 73 75 70 70 6f 72 | 74 20 70 72 65 65 6d 70 |t suppor|t preemp|
|00004260| 74 69 6f 6e 20 61 6e 64 | 20 6e 65 76 65 72 20 77 |tion and| never w|
|00004270| 69 6c 6c 2e 20 46 75 74 | 75 72 65 20 76 65 72 73 |ill. Fut|ure vers|
|00004280| 69 6f 6e 73 20 6f 66 20 | 4d 61 63 4f 53 20 77 69 |ions of |MacOS wi|
|00004290| 6c 6c 20 70 72 6f 76 69 | 64 65 20 70 72 65 65 6d |ll provi|de preem|
|000042a0| 70 74 69 6f 6e 20 66 6f | 72 20 73 70 65 63 69 66 |ption fo|r specif|
|000042b0| 69 63 20 74 61 73 6b 73 | 2e 20 54 68 65 20 69 73 |ic tasks|. The is|
|000042c0| 73 75 65 20 6d 61 79 20 | 62 65 20 72 65 2d 76 69 |sue may |be re-vi|
|000042d0| 73 69 74 65 64 20 74 68 | 65 6e 2e 20 20 0d 09 54 |sited th|en. ..T|
|000042e0| 68 65 72 65 20 77 65 72 | 65 20 73 65 76 65 72 61 |here wer|e severa|
|000042f0| 6c 20 64 65 73 69 67 6e | 20 67 6f 61 6c 73 20 69 |l design| goals i|
|00004300| 6e 20 74 68 69 73 20 69 | 6d 70 6c 65 6d 65 6e 74 |n this i|mplement|
|00004310| 61 74 69 6f 6e 3a 0d 47 | 6f 61 6c 09 44 65 73 63 |ation:.G|oal.Desc|
|00004320| 72 69 70 74 69 6f 6e 0d | 6b 65 65 70 20 74 68 65 |ription.|keep the|
|00004330| 20 63 75 72 72 65 6e 74 | 20 6f 62 6a 65 63 74 20 | current| object |
|00004340| 73 74 72 75 63 74 75 72 | 65 09 46 6f 72 20 67 72 |structur|e.For gr|
|00004350| 65 61 74 65 72 20 72 65 | 6c 69 61 62 69 6c 69 74 |eater re|liabilit|
|00004360| 79 2c 20 73 68 6f 72 74 | 65 72 20 74 69 6d 65 20 |y, short|er time |
|00004370| 74 6f 20 6d 61 72 6b 65 | 74 2c 20 62 61 63 6b 77 |to marke|t, backw|
|00004380| 61 72 64 73 20 63 6f 6d | 70 61 74 69 62 69 6c 69 |ards com|patibili|
|00004390| 74 79 2c 20 61 6e 64 20 | 74 6f 20 73 75 70 70 6f |ty, and |to suppo|
|000043a0| 72 74 20 63 6f 6e 63 75 | 72 72 65 6e 74 20 64 65 |rt concu|rrent de|
|000043b0| 76 65 6c 6f 70 6d 65 6e | 74 20 62 79 20 64 69 66 |velopmen|t by dif|
|000043c0| 66 65 72 65 6e 74 20 65 | 6e 67 69 6e 65 65 72 73 |ferent e|ngineers|
|000043d0| 2c 20 69 74 20 69 73 20 | 69 6d 70 6f 72 74 61 6e |, it is |importan|
|000043e0| 74 20 74 6f 20 73 74 61 | 79 20 63 6c 6f 73 65 20 |t to sta|y close |
|000043f0| 74 6f 20 74 68 65 20 65 | 78 69 73 74 69 6e 67 20 |to the e|xisting |
|00004400| 6d 6f 64 65 6c 20 66 6f | 72 20 70 72 6f 63 65 73 |model fo|r proces|
|00004410| 73 69 6e 67 20 73 65 72 | 76 69 63 65 20 63 61 6c |sing ser|vice cal|
|00004420| 6c 73 2e 20 43 68 61 6e | 67 65 73 20 77 65 72 65 |ls. Chan|ges were|
|00004430| 20 6d 61 64 65 20 74 6f | 20 74 68 65 20 65 78 69 | made to| the exi|
|00004440| 73 74 69 6e 67 20 6d 6f | 64 65 6c 20 6f 6e 6c 79 |sting mo|del only|
|00004450| 20 77 68 65 72 65 20 6e | 65 63 65 73 73 61 72 79 | where n|ecessary|
|00004460| 2e 0d 6d 61 6b 65 20 74 | 68 72 65 61 64 69 6e 67 |..make t|hreading|
|00004470| 20 74 72 61 6e 73 70 61 | 72 65 6e 74 c9 20 09 54 | transpa|rent. .T|
|00004480| 68 65 20 64 65 73 69 67 | 6e 65 72 20 6f 66 20 61 |he desig|ner of a|
|00004490| 20 74 68 72 65 61 64 65 | 64 20 61 6e 64 20 6e 6f | threade|d and no|
|000044a0| 6e 2d 74 68 72 65 61 64 | 65 64 20 73 65 72 76 69 |n-thread|ed servi|
|000044b0| 63 65 73 20 73 68 6f 75 | 6c 64 20 6e 6f 74 20 68 |ces shou|ld not h|
|000044c0| 61 76 65 20 74 6f 20 74 | 68 69 6e 6b 20 61 62 6f |ave to t|hink abo|
|000044d0| 75 74 20 74 68 65 20 6d | 65 63 68 61 6e 69 63 73 |ut the m|echanics|
|000044e0| 20 6f 66 20 74 68 72 65 | 61 64 73 20 61 6e 64 20 | of thre|ads and |
|000044f0| 68 6f 77 20 74 68 65 20 | 61 70 70 6c 69 63 61 74 |how the |applicat|
|00004500| 69 6f 6e 20 69 73 20 74 | 68 72 65 61 64 65 64 2e |ion is t|hreaded.|
|00004510| 20 54 68 65 72 65 20 73 | 68 6f 75 6c 64 20 62 65 | There s|hould be|
|00004520| 20 6e 6f 20 72 65 71 75 | 69 72 65 6d 65 6e 74 73 | no requ|irements|
|00004530| 20 70 6c 61 63 65 64 20 | 6f 6e 20 74 68 65 20 63 | placed |on the c|
|00004540| 6f 64 65 20 66 6f 72 20 | 61 20 74 68 72 65 61 64 |ode for |a thread|
|00004550| 65 64 20 73 65 72 76 69 | 63 65 20 61 73 20 6f 70 |ed servi|ce as op|
|00004560| 70 6f 73 65 64 20 74 6f | 20 61 20 6e 6f 6e 2d 74 |posed to| a non-t|
|00004570| 68 72 65 61 64 65 64 20 | 73 65 72 76 69 63 65 2c |hreaded |service,|
|00004580| 20 62 65 79 6f 6e 64 20 | 6e 6f 72 6d 61 6c 20 63 | beyond |normal c|
|00004590| 61 72 65 20 66 6f 72 20 | 73 68 61 72 65 64 20 64 |are for |shared d|
|000045a0| 61 74 61 20 69 6e 74 65 | 67 72 69 74 79 20 77 68 |ata inte|grity wh|
|000045b0| 69 63 68 20 69 73 20 61 | 20 72 65 71 75 69 72 65 |ich is a| require|
|000045c0| 6d 65 6e 74 20 69 6e 20 | 61 6e 79 20 74 68 72 65 |ment in |any thre|
|000045d0| 61 64 65 64 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |aded env|ironment|
|000045e0| 2e 0d c9 79 65 74 20 61 | 63 63 65 73 73 69 62 6c |...yet a|ccessibl|
|000045f0| 65 20 09 49 66 20 74 68 | 65 20 64 65 73 69 67 6e |e .If th|e design|
|00004600| 65 72 20 73 74 69 6c 6c | 20 6e 65 65 64 73 20 6f |er still| needs o|
|00004610| 72 20 77 61 6e 74 73 20 | 74 6f 20 62 65 20 69 6e |r wants |to be in|
|00004620| 76 6f 6c 76 65 64 20 69 | 6e 20 74 68 65 20 6d 65 |volved i|n the me|
|00004630| 63 68 61 6e 69 63 73 20 | 6f 66 20 74 68 72 65 61 |chanics |of threa|
|00004640| 64 69 6e 67 2c 20 74 68 | 69 73 20 73 68 6f 75 6c |ding, th|is shoul|
|00004650| 64 20 6e 6f 74 20 62 65 | 20 70 72 6f 68 69 62 69 |d not be| prohibi|
|00004660| 74 65 64 20 62 79 20 74 | 68 65 20 69 6d 70 6c 65 |ted by t|he imple|
|00004670| 6d 65 6e 74 61 74 69 6f | 6e 2e 20 54 68 65 20 64 |mentatio|n. The d|
|00004680| 65 73 69 67 6e 65 72 20 | 73 68 6f 75 6c 64 20 62 |esigner |should b|
|00004690| 65 20 61 62 6c 65 20 74 | 6f 20 79 69 65 6c 64 20 |e able t|o yield |
|000046a0| 64 69 66 66 65 72 65 6e | 74 6c 79 2c 20 69 6e 73 |differen|tly, ins|
|000046b0| 74 61 6c 6c 20 63 75 73 | 74 6f 6d 20 65 6e 74 72 |tall cus|tom entr|
|000046c0| 79 20 6f 72 20 65 78 69 | 74 20 72 6f 75 74 69 6e |y or exi|t routin|
|000046d0| 65 73 20 66 6f 72 20 61 | 20 74 68 72 65 61 64 20 |es for a| thread |
|000046e0| 6f 72 20 65 76 65 6e 20 | 69 6e 73 74 61 6c 6c 20 |or even |install |
|000046f0| 61 20 63 75 73 74 6f 6d | 20 73 63 68 65 64 75 6c |a custom| schedul|
|00004700| 65 72 2e 20 41 6e 79 20 | 65 78 63 65 70 74 69 6f |er. Any |exceptio|
|00004710| 6e 73 20 73 68 6f 75 6c | 64 20 62 65 20 6e 6f 74 |ns shoul|d be not|
|00004720| 65 64 20 65 78 70 6c 69 | 63 69 74 6c 79 2e 0d 61 |ed expli|citly..a|
|00004730| 6c 6c 6f 77 20 74 6f 6f | 6c 20 74 6f 20 72 75 6e |llow too|l to run|
|00004740| 20 6e 6f 6e 2d 74 68 72 | 65 61 64 65 64 09 54 68 | non-thr|eaded.Th|
|00004750| 65 20 32 2e 31 20 74 65 | 6d 70 6c 61 74 65 20 73 |e 2.1 te|mplate s|
|00004760| 68 6f 75 6c 64 20 6c 61 | 75 6e 63 68 20 69 6e 20 |hould la|unch in |
|00004770| 61 20 6e 6f 6e 2d 74 68 | 72 65 61 64 65 64 20 65 |a non-th|readed e|
|00004780| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 61 6e 64 20 70 |nvironme|nt and p|
|00004790| 72 6f 63 65 73 73 20 6e | 6f 6e 2d 74 68 72 65 61 |rocess n|on-threa|
|000047a0| 64 65 64 20 73 65 72 76 | 69 63 65 73 2c 20 6a 75 |ded serv|ices, ju|
|000047b0| 73 74 20 6c 69 6b 65 20 | 74 68 65 20 32 2e 30 20 |st like |the 2.0 |
|000047c0| 74 65 6d 70 6c 61 74 65 | 2e 20 49 66 20 61 20 74 |template|. If a t|
|000047d0| 68 72 65 61 64 65 64 20 | 73 65 72 76 69 63 65 20 |hreaded |service |
|000047e0| 61 6c 6c 6f 77 73 20 69 | 74 2c 20 74 68 65 20 32 |allows i|t, the 2|
|000047f0| 2e 31 20 74 65 6d 70 6c | 61 74 65 20 63 6f 75 6c |.1 templ|ate coul|
|00004800| 64 20 61 6c 6c 6f 77 20 | 6e 6f 6e 2d 74 68 72 65 |d allow |non-thre|
|00004810| 61 64 65 64 20 70 72 6f | 63 65 73 73 69 6e 67 20 |aded pro|cessing |
|00004820| 6f 66 20 61 20 74 68 72 | 65 61 64 65 64 20 73 65 |of a thr|eaded se|
|00004830| 72 76 69 63 65 20 77 68 | 65 6e 20 74 68 72 65 61 |rvice wh|en threa|
|00004840| 64 69 6e 67 20 69 73 20 | 64 69 73 61 62 6c 65 64 |ding is |disabled|
|00004850| 2e 0d 4b 49 53 53 21 09 | 54 68 72 65 61 64 73 20 |..KISS!.|Threads |
|00004860| 63 61 6e 20 62 65 20 63 | 6f 6e 66 75 73 69 6e 67 |can be c|onfusing|
|00004870| 20 65 6e 6f 75 67 68 20 | 77 69 74 68 6f 75 74 20 | enough |without |
|00004880| 69 6e 74 72 6f 64 75 63 | 69 6e 67 20 61 20 68 6f |introduc|ing a ho|
|00004890| 73 74 20 6f 66 20 62 65 | 6c 6c 73 20 61 6e 64 20 |st of be|lls and |
|000048a0| 77 68 69 73 74 6c 65 73 | 2e 20 49 66 20 61 20 63 |whistles|. If a c|
|000048b0| 68 6f 69 63 65 20 69 73 | 20 72 65 71 75 69 72 65 |hoice is| require|
|000048c0| 64 20 62 65 74 77 65 65 | 6e 20 6d 6f 72 65 20 66 |d betwee|n more f|
|000048d0| 65 61 74 75 72 65 73 20 | 61 6e 64 20 73 69 6d 70 |eatures |and simp|
|000048e0| 6c 65 72 20 63 6f 64 65 | 2c 20 63 68 6f 6f 73 65 |ler code|, choose|
|000048f0| 20 73 69 6d 70 6c 65 72 | 20 63 6f 64 65 2e 20 4f | simpler| code. O|
|00004900| 6e 63 65 20 77 65 20 67 | 65 74 20 61 20 77 6f 72 |nce we g|et a wor|
|00004910| 6b 69 6e 67 20 74 65 6d | 70 6c 61 74 65 20 69 6e |king tem|plate in|
|00004920| 20 63 75 73 74 6f 6d 65 | 72 73 27 20 68 61 6e 64 | custome|rs' hand|
|00004930| 73 2c 20 77 65 20 63 61 | 6e 20 61 64 64 20 6d 6f |s, we ca|n add mo|
|00004940| 72 65 20 66 65 61 74 75 | 72 65 73 20 61 73 20 6e |re featu|res as n|
|00004950| 65 65 64 65 64 20 69 6e | 20 74 68 65 20 6e 65 78 |eeded in| the nex|
|00004960| 74 20 72 65 76 69 73 69 | 6f 6e 20 6f 66 20 74 68 |t revisi|on of th|
|00004970| 65 20 74 65 6d 70 6c 61 | 74 65 2e 0d 09 54 68 65 |e templa|te...The|
|00004980| 20 32 2e 31 20 74 65 6d | 70 6c 61 74 65 20 61 73 | 2.1 tem|plate as|
|00004990| 73 6f 63 69 61 74 65 73 | 20 74 68 72 65 61 64 73 |sociates| threads|
|000049a0| 20 77 69 74 68 20 73 65 | 76 65 72 61 6c 20 6b 65 | with se|veral ke|
|000049b0| 79 20 6f 62 6a 65 63 74 | 20 74 79 70 65 73 3a 0d |y object| types:.|
|000049c0| 4f 62 6a 65 63 74 20 54 | 79 70 65 09 46 75 6e 63 |Object T|ype.Func|
|000049d0| 74 69 6f 6e 0d 41 70 70 | 6c 69 63 61 74 69 6f 6e |tion.App|lication|
|000049e0| 20 74 68 72 65 61 64 09 | 6b 41 70 70 6c 69 63 61 | thread.|kApplica|
|000049f0| 74 69 6f 6e 54 68 72 65 | 61 64 49 44 3b 20 63 72 |tionThre|adID; cr|
|00004a00| 65 61 74 65 64 20 62 79 | 20 74 68 65 20 54 68 72 |eated by| the Thr|
|00004a10| 65 61 64 20 4d 61 6e 61 | 67 65 72 3b 20 73 70 65 |ead Mana|ger; spe|
|00004a20| 6e 64 73 20 74 69 6d 65 | 20 69 6e 20 74 68 65 20 |nds time| in the |
|00004a30| 52 75 6e 28 29 20 6c 6f | 6f 70 3b 20 63 72 65 61 |Run() lo|op; crea|
|00004a40| 74 65 73 20 74 68 65 20 | 52 65 71 75 65 73 74 44 |tes the |RequestD|
|00004a50| 69 73 70 61 74 63 68 65 | 72 20 74 68 72 65 61 64 |ispatche|r thread|
|00004a60| 3b 20 63 61 6c 6c 73 20 | 74 68 65 20 45 76 65 6e |; calls |the Even|
|00004a70| 74 20 4d 61 6e 61 67 65 | 72 3b 20 64 69 73 70 6f |t Manage|r; dispo|
|00004a80| 73 65 64 20 61 74 20 71 | 75 69 74 3b 0d 52 65 71 |sed at q|uit;.Req|
|00004a90| 75 65 73 74 44 69 73 70 | 61 74 63 68 65 72 20 74 |uestDisp|atcher t|
|00004aa0| 68 72 65 61 64 09 67 52 | 65 71 75 65 73 74 44 69 |hread.gR|equestDi|
|00004ab0| 73 70 61 74 63 68 65 72 | 54 68 72 65 61 64 49 44 |spatcher|ThreadID|
|00004ac0| 3b 20 63 72 65 61 74 65 | 64 20 62 79 20 74 68 65 |; create|d by the|
|00004ad0| 20 41 70 70 6c 69 63 61 | 74 69 6f 6e 20 74 68 72 | Applica|tion thr|
|00004ae0| 65 61 64 3b 20 73 70 65 | 6e 64 73 20 74 69 6d 65 |ead; spe|nds time|
|00004af0| 20 69 6e 20 74 68 65 20 | 44 6f 52 65 71 75 65 73 | in the |DoReques|
|00004b00| 74 73 28 29 20 6c 6f 6f | 70 3b 20 65 78 65 63 75 |ts() loo|p; execu|
|00004b10| 74 65 73 20 63 61 6c 6c | 73 20 74 6f 20 6e 6f 6e |tes call|s to non|
|00004b20| 2d 74 68 72 65 61 64 65 | 64 20 73 65 72 76 69 63 |-threade|d servic|
|00004b30| 65 73 3b 20 73 74 61 72 | 74 73 20 61 20 6e 65 77 |es; star|ts a new|
|00004b40| 20 74 68 72 65 61 64 20 | 66 6f 72 20 65 61 63 68 | thread |for each|
|00004b50| 20 63 61 6c 6c 20 74 6f | 20 61 20 74 68 72 65 61 | call to| a threa|
|00004b60| 64 65 64 20 73 65 72 76 | 69 63 65 3b 20 64 69 73 |ded serv|ice; dis|
|00004b70| 70 6f 73 65 64 20 61 74 | 20 71 75 69 74 3b 0d 54 |posed at| quit;.T|
|00004b80| 68 72 65 61 64 65 64 53 | 65 72 76 69 63 65 20 6f |hreadedS|ervice o|
|00004b90| 62 6a 65 63 74 09 6e 65 | 77 20 63 6c 61 73 73 20 |bject.ne|w class |
|00004ba0| 66 6f 72 20 74 68 72 65 | 61 64 69 6e 67 20 74 68 |for thre|ading th|
|00004bb0| 65 20 62 61 73 65 20 63 | 6c 61 73 73 20 53 65 72 |e base c|lass Ser|
|00004bc0| 76 69 63 65 3b 20 73 65 | 72 76 65 73 20 61 73 20 |vice; se|rves as |
|00004bd0| 61 20 74 65 6d 70 6c 61 | 74 65 20 66 6f 72 20 63 |a templa|te for c|
|00004be0| 72 65 61 74 69 6e 67 20 | 6e 65 77 20 74 68 72 65 |reating |new thre|
|00004bf0| 61 64 73 3a 20 65 6e 74 | 72 79 20 66 75 6e 63 74 |ads: ent|ry funct|
|00004c00| 69 6f 6e 20 70 6f 69 6e | 74 65 72 2c 20 73 74 61 |ion poin|ter, sta|
|00004c10| 63 6b 20 73 69 7a 65 2c | 20 74 68 72 65 61 64 20 |ck size,| thread |
|00004c20| 6f 70 74 69 6f 6e 73 2c | 20 74 69 6d 65 6f 75 74 |options,| timeout|
|00004c30| 20 69 6e 74 65 72 76 61 | 6c 3b 0d 52 65 71 75 65 | interva|l;.Reque|
|00004c40| 73 74 20 74 68 72 65 61 | 64 09 52 65 71 75 65 73 |st threa|d.Reques|
|00004c50| 74 2e 66 54 68 72 65 61 | 64 49 44 3b 20 63 72 65 |t.fThrea|dID; cre|
|00004c60| 61 74 65 64 20 62 79 20 | 52 65 71 75 65 73 74 44 |ated by |RequestD|
|00004c70| 69 73 70 61 74 63 68 65 | 72 20 74 68 72 65 61 64 |ispatche|r thread|
|00004c80| 20 66 6f 72 20 65 61 63 | 68 20 63 61 6c 6c 20 74 | for eac|h call t|
|00004c90| 6f 20 61 20 74 68 72 65 | 61 64 65 64 20 73 65 72 |o a thre|aded ser|
|00004ca0| 76 69 63 65 3b 20 73 70 | 65 6e 64 73 20 74 69 6d |vice; sp|ends tim|
|00004cb0| 65 20 69 6e 20 74 68 65 | 20 50 72 6f 63 65 73 73 |e in the| Process|
|00004cc0| 52 65 71 75 65 73 74 28 | 29 20 6c 6f 6f 70 3b 20 |Request(|) loop; |
|00004cd0| 73 65 6c 66 20 64 69 73 | 70 6f 73 69 6e 67 3b 0d |self dis|posing;.|
|00004ce0| 43 6f 6f 70 65 72 61 74 | 69 76 65 20 54 68 72 65 |Cooperat|ive Thre|
|00004cf0| 61 64 65 64 20 4d 6f 64 | 65 6c 0d 09 54 68 65 20 |aded Mod|el..The |
|00004d00| 69 6d 70 6c 65 6d 65 6e | 74 61 74 69 6f 6e 20 6f |implemen|tation o|
|00004d10| 66 20 74 68 72 65 61 64 | 73 20 69 6e 20 74 68 65 |f thread|s in the|
|00004d20| 20 43 2b 2b 20 65 78 74 | 65 72 6e 61 6c 20 74 6f | C++ ext|ernal to|
|00004d30| 6f 6c 20 6d 6f 64 65 6c | 20 63 65 6e 74 65 72 73 |ol model| centers|
|00004d40| 20 61 72 6f 75 6e 64 20 | 66 6f 75 72 20 6f 62 6a | around |four obj|
|00004d50| 65 63 74 20 63 6c 61 73 | 73 65 73 3a 20 41 70 70 |ect clas|ses: App|
|00004d60| 6c 69 63 61 74 69 6f 6e | 2c 20 52 65 71 75 65 73 |lication|, Reques|
|00004d70| 74 44 69 73 70 61 74 63 | 68 65 72 2c 20 54 68 72 |tDispatc|her, Thr|
|00004d80| 65 61 64 65 64 53 65 72 | 76 69 63 65 20 61 6e 64 |eadedSer|vice and|
|00004d90| 20 52 65 71 75 65 73 74 | 2e 20 54 68 65 20 41 70 | Request|. The Ap|
|00004da0| 70 6c 69 63 61 74 69 6f | 6e 20 61 6e 64 20 52 65 |plicatio|n and Re|
|00004db0| 71 75 65 73 74 44 69 73 | 70 61 74 63 68 65 72 20 |questDis|patcher |
|00004dc0| 6f 62 6a 65 63 74 73 20 | 61 6c 72 65 61 64 79 20 |objects |already |
|00004dd0| 70 72 6f 76 69 64 65 20 | 74 77 6f 20 64 69 73 74 |provide |two dist|
|00004de0| 69 6e 63 74 20 66 75 6e | 63 74 69 6f 6e 73 20 77 |inct fun|ctions w|
|00004df0| 69 74 68 69 6e 20 74 68 | 65 20 74 6f 6f 6c 2c 20 |ithin th|e tool, |
|00004e00| 73 6f 20 69 74 20 6d 61 | 6b 65 73 20 73 65 6e 73 |so it ma|kes sens|
|00004e10| 65 20 74 68 61 74 20 74 | 68 65 79 20 73 68 6f 75 |e that t|hey shou|
|00004e20| 6c 64 20 62 65 20 69 6e | 20 74 77 6f 20 73 65 70 |ld be in| two sep|
|00004e30| 61 72 61 74 65 20 74 68 | 72 65 61 64 73 2e 20 54 |arate th|reads. T|
|00004e40| 68 65 20 41 70 70 6c 69 | 63 61 74 69 6f 6e 20 74 |he Appli|cation t|
|00004e50| 68 72 65 61 64 20 63 6f | 6e 76 65 72 74 73 20 56 |hread co|nverts V|
|00004e60| 55 20 65 78 74 65 72 6e | 61 6c 20 74 6f 6f 6c 20 |U extern|al tool |
|00004e70| 41 70 70 6c 65 20 65 76 | 65 6e 74 73 20 69 6e 74 |Apple ev|ents int|
|00004e80| 6f 20 41 45 52 65 71 75 | 65 73 74 20 6f 62 6a 65 |o AERequ|est obje|
|00004e90| 63 74 73 20 61 6e 64 20 | 70 6c 61 63 65 73 20 74 |cts and |places t|
|00004ea0| 68 65 73 65 20 69 6e 20 | 74 68 65 20 70 65 6e 64 |hese in |the pend|
|00004eb0| 69 6e 67 20 71 75 65 75 | 65 2e 20 41 73 79 6e 63 |ing queu|e. Async|
|00004ec0| 68 72 6f 6e 6f 75 73 6c | 79 2c 20 74 68 65 20 52 |hronousl|y, the R|
|00004ed0| 65 71 75 65 73 74 44 69 | 73 70 61 74 63 68 65 72 |equestDi|spatcher|
|00004ee0| 20 74 68 72 65 61 64 20 | 72 65 6d 6f 76 65 73 20 | thread |removes |
|00004ef0| 74 68 65 6d 20 66 72 6f | 6d 20 74 68 65 20 71 75 |them fro|m the qu|
|00004f00| 65 75 65 20 61 6e 64 20 | 70 72 6f 63 65 73 73 65 |eue and |processe|
|00004f10| 73 20 74 68 65 6d 2e 20 | 0d 09 46 6f 72 20 62 61 |s them. |..For ba|
|00004f20| 63 6b 77 61 72 64 73 20 | 63 6f 6d 70 61 74 69 62 |ckwards |compatib|
|00004f30| 69 6c 69 74 79 2c 20 74 | 68 65 20 32 2e 30 20 73 |ility, t|he 2.0 s|
|00004f40| 74 79 6c 65 20 6e 6f 6e | 2d 74 68 72 65 61 64 65 |tyle non|-threade|
|00004f50| 64 20 53 65 72 76 69 63 | 65 20 6f 62 6a 65 63 74 |d Servic|e object|
|00004f60| 73 20 61 72 65 20 66 75 | 6c 6c 79 20 73 75 70 70 |s are fu|lly supp|
|00004f70| 6f 72 74 65 64 2e 20 49 | 6e 20 74 68 65 20 74 68 |orted. I|n the th|
|00004f80| 72 65 61 64 65 64 20 6d | 6f 64 65 6c 2c 20 22 6e |readed m|odel, "n|
|00004f90| 6f 6e 2d 74 68 72 65 61 | 64 65 64 20 65 78 65 63 |on-threa|ded exec|
|00004fa0| 75 74 69 6f 6e 22 20 6d | 65 61 6e 73 20 6e 6f 20 |ution" m|eans no |
|00004fb0| 6f 74 68 65 72 20 73 65 | 72 76 69 63 65 20 69 73 |other se|rvice is|
|00004fc0| 20 67 69 76 65 6e 20 61 | 6e 79 20 74 69 6d 65 20 | given a|ny time |
|00004fd0| 75 6e 74 69 6c 20 74 68 | 65 20 6e 6f 6e 2d 74 68 |until th|e non-th|
|00004fe0| 72 65 61 64 65 64 20 73 | 65 72 76 69 63 65 20 63 |readed s|ervice c|
|00004ff0| 6f 6d 70 6c 65 74 65 73 | 2e 20 54 68 69 73 20 6d |ompletes|. This m|
|00005000| 61 69 6e 74 61 69 6e 73 | 20 74 68 65 20 6f 72 69 |aintains| the ori|
|00005010| 67 69 6e 61 6c 20 6d 6f | 64 65 6c 20 77 68 65 72 |ginal mo|del wher|
|00005020| 65 20 6f 6e 6c 79 20 6f | 6e 65 20 61 63 74 69 76 |e only o|ne activ|
|00005030| 65 20 73 65 72 76 69 63 | 65 20 63 61 6c 6c 20 63 |e servic|e call c|
|00005040| 6f 75 6c 64 20 65 78 65 | 63 75 74 65 20 61 74 20 |ould exe|cute at |
|00005050| 61 20 74 69 6d 65 2c 20 | 61 6e 64 20 61 6c 6c 20 |a time, |and all |
|00005060| 6f 74 68 65 72 20 52 65 | 71 75 65 73 74 73 20 72 |other Re|quests r|
|00005070| 65 6d 61 69 6e 65 64 20 | 69 6e 20 74 68 65 20 70 |emained |in the p|
|00005080| 65 6e 64 69 6e 67 20 72 | 65 71 75 65 73 74 20 71 |ending r|equest q|
|00005090| 75 65 75 65 2e 20 4e 6f | 6e 2d 74 68 72 65 61 64 |ueue. No|n-thread|
|000050a0| 65 64 20 73 65 72 76 69 | 63 65 73 20 61 6c 73 6f |ed servi|ces also|
|000050b0| 20 70 72 6f 76 69 64 65 | 20 73 6f 6d 65 20 61 64 | provide| some ad|
|000050c0| 76 61 6e 74 61 67 65 73 | 3a 20 74 68 65 79 20 75 |vantages|: they u|
|000050d0| 73 65 20 6c 65 73 73 20 | 6f 76 65 72 68 65 61 64 |se less |overhead|
|000050e0| 20 69 6e 20 70 72 6f 63 | 65 73 73 6f 72 20 74 69 | in proc|essor ti|
|000050f0| 6d 65 20 61 6e 64 20 6d | 65 6d 6f 72 79 2c 20 61 |me and m|emory, a|
|00005100| 6e 64 20 61 72 65 20 67 | 6f 6f 64 20 66 6f 72 20 |nd are g|ood for |
|00005110| 74 61 73 6b 73 20 74 68 | 61 74 20 6d 75 73 74 20 |tasks th|at must |
|00005120| 6e 6f 74 20 62 65 20 69 | 6e 74 65 72 72 75 70 74 |not be i|nterrupt|
|00005130| 65 64 20 62 79 20 61 6e | 6f 74 68 65 72 20 74 68 |ed by an|other th|
|00005140| 72 65 61 64 2c 20 73 75 | 63 68 20 61 73 20 6c 69 |read, su|ch as li|
|00005150| 73 74 20 6d 61 6e 69 70 | 75 6c 61 74 69 6f 6e 2e |st manip|ulation.|
|00005160| 20 0d 09 54 68 65 20 43 | 68 65 63 6b 46 6f 72 43 | ..The C|heckForC|
|00005170| 61 6e 63 65 6c 28 29 20 | 66 75 6e 63 74 69 6f 6e |ancel() |function|
|00005180| 20 77 61 73 20 63 72 65 | 61 74 65 64 20 69 6e 20 | was cre|ated in |
|00005190| 74 68 65 20 32 2e 30 20 | 74 65 6d 70 6c 61 74 65 |the 2.0 |template|
|000051a0| 20 74 6f 20 61 6c 6c 6f | 77 20 45 76 65 6e 74 20 | to allo|w Event |
|000051b0| 4d 61 6e 61 67 65 72 20 | 61 63 63 65 73 73 20 61 |Manager |access a|
|000051c0| 6e 64 20 70 72 6f 76 69 | 64 65 20 61 20 71 75 69 |nd provi|de a qui|
|000051d0| 63 6b 20 72 65 73 70 6f | 6e 73 65 20 74 6f 20 61 |ck respo|nse to a|
|000051e0| 20 43 61 6e 63 65 6c 20 | 73 65 72 76 69 63 65 2e | Cancel |service.|
|000051f0| 20 49 74 20 69 73 20 66 | 75 6c 6c 79 20 73 75 70 | It is f|ully sup|
|00005200| 70 6f 72 74 65 64 20 69 | 6e 20 69 74 73 20 32 2e |ported i|n its 2.|
|00005210| 30 20 64 65 66 69 6e 69 | 74 69 6f 6e 20 66 6f 72 |0 defini|tion for|
|00005220| 20 6e 6f 6e 2d 74 68 72 | 65 61 64 65 64 20 73 65 | non-thr|eaded se|
|00005230| 72 76 69 63 65 73 2c 20 | 61 6e 64 20 69 74 20 68 |rvices, |and it h|
|00005240| 61 73 20 61 20 6e 65 77 | 20 6d 65 61 6e 69 6e 67 |as a new| meaning|
|00005250| 20 66 6f 72 20 74 68 72 | 65 61 64 65 64 20 73 65 | for thr|eaded se|
|00005260| 72 76 69 63 65 73 3a 20 | 79 69 65 6c 64 20 74 6f |rvices: |yield to|
|00005270| 20 61 6e 6f 74 68 65 72 | 20 74 68 72 65 61 64 2e | another| thread.|
|00005280| 20 54 68 65 20 66 75 6e | 63 74 69 6f 6e 20 70 72 | The fun|ction pr|
|00005290| 6f 76 69 64 65 73 20 74 | 68 65 20 73 61 6d 65 20 |ovides t|he same |
|000052a0| 62 61 73 69 63 20 65 66 | 66 65 63 74 20 69 66 20 |basic ef|fect if |
|000052b0| 74 68 72 65 61 64 69 6e | 67 20 69 73 20 65 6e 61 |threadin|g is ena|
|000052c0| 62 6c 65 64 20 6f 72 20 | 6e 6f 74 2c 20 61 6e 64 |bled or |not, and|
|000052d0| 20 69 66 20 61 20 73 65 | 72 76 69 63 65 20 69 73 | if a se|rvice is|
|000052e0| 20 74 68 72 65 61 64 65 | 64 20 6f 72 20 6e 6f 74 | threade|d or not|
|000052f0| 2e 20 4f 6e 6c 79 20 73 | 65 72 76 69 63 65 73 20 |. Only s|ervices |
|00005300| 74 68 61 74 20 74 61 6b | 65 20 73 65 76 65 72 61 |that tak|e severa|
|00005310| 6c 20 73 65 63 6f 6e 64 | 73 20 6e 65 65 64 20 74 |l second|s need t|
|00005320| 6f 20 63 61 6c 6c 20 43 | 68 65 63 6b 46 6f 72 43 |o call C|heckForC|
|00005330| 61 6e 63 65 6c 28 29 2e | 20 4d 61 6e 79 20 73 65 |ancel().| Many se|
|00005340| 72 76 69 63 65 73 20 61 | 72 65 20 73 6f 20 66 61 |rvices a|re so fa|
|00005350| 73 74 20 74 68 61 74 20 | 73 75 70 70 6f 72 74 69 |st that |supporti|
|00005360| 6e 67 20 63 61 6e 63 65 | 6c 20 64 6f 65 73 20 6e |ng cance|l does n|
|00005370| 6f 74 20 6d 61 6b 65 20 | 61 6e 79 20 73 65 6e 73 |ot make |any sens|
|00005380| 65 2e 20 41 6c 73 6f 2c | 20 56 55 20 73 75 70 70 |e. Also,| VU supp|
|00005390| 6f 72 74 73 20 63 61 6e | 63 65 6c 69 6e 67 20 6f |orts can|celing o|
|000053a0| 6e 6c 79 20 66 6f 72 20 | 73 65 72 76 69 63 65 20 |nly for |service |
|000053b0| 63 61 6c 6c 73 20 74 68 | 61 74 20 61 72 65 20 6d |calls th|at are m|
|000053c0| 61 64 65 20 61 73 79 6e | 63 68 72 6f 6e 6f 75 73 |ade asyn|chronous|
|000053d0| 6c 79 2e 0d 09 49 66 20 | 61 20 52 65 71 75 65 73 |ly...If |a Reques|
|000053e0| 74 20 6f 62 6a 65 63 74 | 20 63 6f 6e 74 61 69 6e |t object| contain|
|000053f0| 73 20 61 20 63 61 6c 6c | 20 66 6f 72 20 61 20 6e |s a call| for a n|
|00005400| 6f 6e 2d 74 68 72 65 61 | 64 65 64 20 53 65 72 76 |on-threa|ded Serv|
|00005410| 69 63 65 2c 20 74 68 65 | 20 52 65 71 75 65 73 74 |ice, the| Request|
|00005420| 44 69 73 70 61 74 63 68 | 65 72 20 74 68 72 65 61 |Dispatch|er threa|
|00005430| 64 20 65 78 65 63 75 74 | 65 73 20 74 68 65 20 73 |d execut|es the s|
|00005440| 65 72 76 69 63 65 20 74 | 6f 20 73 69 6d 75 6c 61 |ervice t|o simula|
|00005450| 74 65 20 6e 6f 6e 2d 74 | 68 72 65 61 64 65 64 20 |te non-t|hreaded |
|00005460| 6f 70 65 72 61 74 69 6f | 6e 2e 20 41 20 77 65 6c |operatio|n. A wel|
|00005470| 6c 20 64 65 73 69 67 6e | 65 64 20 6e 6f 6e 2d 74 |l design|ed non-t|
|00005480| 68 72 65 61 64 65 64 20 | 73 65 72 76 69 63 65 20 |hreaded |service |
|00005490| 65 78 65 63 75 74 65 73 | 20 61 73 20 61 6e 20 69 |executes| as an i|
|000054a0| 6e 66 69 6e 69 74 65 20 | 6c 6f 6f 70 3a 20 70 72 |nfinite |loop: pr|
|000054b0| 6f 63 65 73 73 20 73 6f | 6d 65 20 69 6e 66 6f 72 |ocess so|me infor|
|000054c0| 6d 61 74 69 6f 6e 3b 20 | 63 61 6c 6c 20 43 68 65 |mation; |call Che|
|000054d0| 63 6b 46 6f 72 43 61 6e | 63 65 6c 28 29 3b 20 70 |ckForCan|cel(); p|
|000054e0| 72 6f 63 65 73 73 20 73 | 6f 6d 65 20 6d 6f 72 65 |rocess s|ome more|
|000054f0| 3b 20 63 61 6c 6c 20 43 | 68 65 63 6b 46 6f 72 43 |; call C|heckForC|
|00005500| 61 6e 63 65 6c 28 29 2c | 20 61 6e 64 20 73 6f 20 |ancel(),| and so |
|00005510| 6f 6e 2e 20 49 6e 20 74 | 68 69 73 20 63 61 73 65 |on. In t|his case|
|00005520| 2c 20 43 68 65 63 6b 46 | 6f 72 43 61 6e 63 65 6c |, CheckF|orCancel|
|00005530| 28 29 20 79 69 65 6c 64 | 73 20 65 78 70 6c 69 63 |() yield|s explic|
|00005540| 69 74 6c 79 20 74 6f 20 | 74 68 65 20 41 70 70 6c |itly to |the Appl|
|00005550| 69 63 61 74 69 6f 6e 20 | 74 68 72 65 61 64 20 74 |ication |thread t|
|00005560| 6f 20 61 6c 6c 6f 77 20 | 45 76 65 6e 74 20 4d 61 |o allow |Event Ma|
|00005570| 6e 61 67 65 72 20 61 63 | 63 65 73 73 2c 20 69 6e |nager ac|cess, in|
|00005580| 73 74 65 61 64 20 6f 66 | 20 79 69 65 6c 64 69 6e |stead of| yieldin|
|00005590| 67 20 74 6f 20 61 6e 79 | 20 74 68 72 65 61 64 2e |g to any| thread.|
|000055a0| 20 54 6f 20 65 6e 73 75 | 72 65 20 74 68 69 73 20 | To ensu|re this |
|000055b0| 77 6f 72 6b 73 2c 20 74 | 68 65 20 41 70 70 6c 69 |works, t|he Appli|
|000055c0| 63 61 74 69 6f 6e 20 74 | 68 72 65 61 64 20 61 6c |cation t|hread al|
|000055d0| 77 61 79 73 20 79 69 65 | 6c 64 73 20 65 78 70 6c |ways yie|lds expl|
|000055e0| 69 63 69 74 6c 79 20 74 | 6f 20 74 68 65 20 52 65 |icitly t|o the Re|
|000055f0| 71 75 65 73 74 44 69 73 | 70 61 74 63 68 65 72 20 |questDis|patcher |
|00005600| 74 68 72 65 61 64 2e 20 | 54 68 75 73 2c 20 66 6f |thread. |Thus, fo|
|00005610| 72 20 6e 6f 6e 2d 74 68 | 72 65 61 64 65 64 20 65 |r non-th|readed e|
|00005620| 78 65 63 75 74 69 6f 6e | 20 69 6e 20 74 68 65 20 |xecution| in the |
|00005630| 74 68 72 65 61 64 65 64 | 20 6d 6f 64 65 6c 2c 20 |threaded| model, |
|00005640| 74 68 65 20 41 70 70 6c | 69 63 61 74 69 6f 6e 20 |the Appl|ication |
|00005650| 61 6e 64 20 52 65 71 75 | 65 73 74 44 69 73 70 61 |and Requ|estDispa|
|00005660| 74 63 68 65 72 20 74 68 | 72 65 61 64 73 20 79 69 |tcher th|reads yi|
|00005670| 65 6c 64 20 6f 6e 6c 79 | 20 74 6f 20 65 61 63 68 |eld only| to each|
|00005680| 20 6f 74 68 65 72 2c 20 | 61 6e 64 20 6e 6f 20 6f | other, |and no o|
|00005690| 74 68 65 72 20 74 68 72 | 65 61 64 20 72 65 63 65 |ther thr|ead rece|
|000056a0| 69 76 65 73 20 74 69 6d | 65 2e 0d 09 0d 09 49 66 |ives tim|e.....If|
|000056b0| 20 61 20 52 65 71 75 65 | 73 74 20 63 6f 6e 74 61 | a Reque|st conta|
|000056c0| 69 6e 73 20 61 20 63 61 | 6c 6c 20 66 6f 72 20 61 |ins a ca|ll for a|
|000056d0| 20 54 68 72 65 61 64 65 | 64 53 65 72 76 69 63 65 | Threade|dService|
|000056e0| 2c 20 74 68 65 20 52 65 | 71 75 65 73 74 44 69 73 |, the Re|questDis|
|000056f0| 70 61 74 63 68 65 72 20 | 74 68 72 65 61 64 20 63 |patcher |thread c|
|00005700| 72 65 61 74 65 73 20 61 | 20 6e 65 77 20 74 68 72 |reates a| new thr|
|00005710| 65 61 64 20 61 6e 64 20 | 73 74 61 72 74 73 20 69 |ead and |starts i|
|00005720| 74 73 20 65 78 65 63 75 | 74 69 6f 6e 2e 20 41 20 |ts execu|tion. A |
|00005730| 77 65 6c 6c 20 64 65 73 | 69 67 6e 65 64 20 74 68 |well des|igned th|
|00005740| 72 65 61 64 65 64 20 73 | 65 72 76 69 63 65 20 65 |readed s|ervice e|
|00005750| 78 65 63 75 74 65 73 20 | 61 73 20 61 6e 20 69 6e |xecutes |as an in|
|00005760| 66 69 6e 69 74 65 20 6c | 6f 6f 70 2c 20 6a 75 73 |finite l|oop, jus|
|00005770| 74 20 6c 69 6b 65 20 61 | 20 3a 20 70 72 6f 63 65 |t like a| : proce|
|00005780| 73 73 20 73 6f 6d 65 20 | 69 6e 66 6f 72 6d 61 74 |ss some |informat|
|00005790| 69 6f 6e 3b 20 63 61 6c | 6c 20 43 68 65 63 6b 46 |ion; cal|l CheckF|
|000057a0| 6f 72 43 61 6e 63 65 6c | 28 29 3b 20 70 72 6f 63 |orCancel|(); proc|
|000057b0| 65 73 73 20 73 6f 6d 65 | 20 6d 6f 72 65 3b 20 63 |ess some| more; c|
|000057c0| 61 6c 6c 20 43 68 65 63 | 6b 46 6f 72 43 61 6e 63 |all Chec|kForCanc|
|000057d0| 65 6c 28 29 2c 20 61 6e | 64 20 73 6f 20 6f 6e 20 |el(), an|d so on |
|000057e0| 28 73 6f 75 6e 64 20 66 | 61 6d 69 6c 69 61 72 3f |(sound f|amiliar?|
|000057f0| 29 2e 20 49 6e 20 74 68 | 69 73 20 63 61 73 65 2c |). In th|is case,|
|00005800| 20 43 68 65 63 6b 46 6f | 72 43 61 6e 63 65 6c 28 | CheckFo|rCancel(|
|00005810| 29 20 79 69 65 6c 64 73 | 20 74 6f 20 74 68 65 20 |) yields| to the |
|00005820| 6e 65 78 74 20 74 68 72 | 65 61 64 2c 20 77 68 69 |next thr|ead, whi|
|00005830| 63 68 20 6d 61 79 20 6f | 72 20 6d 61 79 20 6e 6f |ch may o|r may no|
|00005840| 74 20 62 65 20 74 68 65 | 20 41 70 70 6c 69 63 61 |t be the| Applica|
|00005850| 74 69 6f 6e 20 74 68 72 | 65 61 64 2e 20 41 6c 6c |tion thr|ead. All|
|00005860| 20 6f 74 68 65 72 20 74 | 68 72 65 61 64 73 20 61 | other t|hreads a|
|00005870| 72 65 20 61 73 73 75 6d | 65 64 20 74 6f 20 62 65 |re assum|ed to be|
|00005880| 20 6a 75 73 74 20 61 73 | 20 63 6f 6f 70 65 72 61 | just as| coopera|
|00005890| 74 69 76 65 2c 20 6f 74 | 68 65 72 77 69 73 65 20 |tive, ot|herwise |
|000058a0| 74 68 65 20 74 68 72 65 | 61 64 65 64 20 6d 6f 64 |the thre|aded mod|
|000058b0| 65 6c 20 77 6f 75 6c 64 | 20 6e 6f 74 20 77 6f 72 |el would| not wor|
|000058c0| 6b 2e 20 0d 09 41 20 74 | 68 72 65 61 64 65 64 20 |k. ..A t|hreaded |
|000058d0| 73 65 72 76 69 63 65 20 | 63 6f 6d 70 6c 65 74 65 |service |complete|
|000058e0| 73 20 62 79 20 61 6c 6c | 6f 77 69 6e 67 20 69 74 |s by all|owing it|
|000058f0| 73 20 63 75 73 74 6f 6d | 20 50 72 6f 63 65 73 73 |s custom| Process|
|00005900| 52 65 71 75 65 73 74 28 | 29 20 6d 65 6d 62 65 72 |Request(|) member|
|00005910| 20 66 75 6e 63 74 69 6f | 6e 20 74 6f 20 72 65 74 | functio|n to ret|
|00005920| 75 72 6e 2c 20 6a 75 73 | 74 20 6c 69 6b 65 20 61 |urn, jus|t like a|
|00005930| 20 6e 6f 6e 2d 74 68 72 | 65 61 64 65 64 20 73 65 | non-thr|eaded se|
|00005940| 72 76 69 63 65 2e 20 4f | 6e 63 65 20 74 68 65 20 |rvice. O|nce the |
|00005950| 66 75 6e 63 74 69 6f 6e | 20 72 65 74 75 72 6e 73 |function| returns|
|00005960| 2c 20 69 74 73 20 52 65 | 71 75 65 73 74 20 6f 62 |, its Re|quest ob|
|00005970| 6a 65 63 74 20 69 73 20 | 61 75 74 6f 6d 61 74 69 |ject is |automati|
|00005980| 63 61 6c 6c 79 20 72 65 | 6d 6f 76 65 64 20 66 72 |cally re|moved fr|
|00005990| 6f 6d 20 74 68 65 20 61 | 63 74 69 76 65 20 72 65 |om the a|ctive re|
|000059a0| 71 75 65 73 74 20 71 75 | 65 75 65 20 61 6e 64 20 |quest qu|eue and |
|000059b0| 69 74 73 20 74 68 72 65 | 61 64 20 69 73 20 64 69 |its thre|ad is di|
|000059c0| 73 70 6f 73 65 64 2e 20 | 54 68 65 20 73 65 72 76 |sposed. |The serv|
|000059d0| 69 63 65 20 77 72 69 74 | 65 72 20 6e 65 65 64 73 |ice writ|er needs|
|000059e0| 20 74 6f 20 64 69 73 70 | 6f 73 65 20 6f 6e 6c 79 | to disp|ose only|
|000059f0| 20 74 68 65 20 6f 62 6a | 65 63 74 73 20 65 78 70 | the obj|ects exp|
|00005a00| 6c 69 63 69 74 6c 79 20 | 63 72 65 61 74 65 64 20 |licitly |created |
|00005a10| 77 69 74 68 69 6e 20 74 | 68 65 20 50 72 6f 63 65 |within t|he Proce|
|00005a20| 73 73 52 65 71 75 65 73 | 74 28 29 20 66 75 6e 63 |ssReques|t() func|
|00005a30| 74 69 6f 6e 2e 0d 09 41 | 20 74 68 72 65 61 64 65 |tion...A| threade|
|00005a40| 64 20 73 65 72 76 69 63 | 65 20 6d 61 79 20 79 69 |d servic|e may yi|
|00005a50| 65 6c 64 20 65 78 70 6c | 69 63 69 74 6c 79 20 74 |eld expl|icitly t|
|00005a60| 6f 20 61 6e 79 20 6f 74 | 68 65 72 20 74 68 72 65 |o any ot|her thre|
|00005a70| 61 64 2c 20 69 6e 63 6c | 75 64 69 6e 67 20 74 68 |ad, incl|uding th|
|00005a80| 65 20 41 70 70 6c 69 63 | 61 74 69 6f 6e 20 6f 72 |e Applic|ation or|
|00005a90| 20 52 65 71 75 65 73 74 | 44 69 73 70 61 74 63 68 | Request|Dispatch|
|00005aa0| 65 72 20 74 68 72 65 61 | 64 73 2e 20 48 6f 77 65 |er threa|ds. Howe|
|00005ab0| 76 65 72 2c 20 79 6f 75 | 20 6d 75 73 74 20 6e 6f |ver, you| must no|
|00005ac0| 74 20 6d 6f 64 69 66 79 | 20 74 68 65 20 77 61 79 |t modify| the way|
|00005ad0| 20 69 6e 20 77 68 69 63 | 68 20 74 68 65 20 41 70 | in whic|h the Ap|
|00005ae0| 70 6c 69 63 61 74 69 6f | 6e 20 61 6e 64 20 52 65 |plicatio|n and Re|
|00005af0| 71 75 65 73 74 44 69 73 | 70 61 74 63 68 65 72 73 |questDis|patchers|
|00005b00| 20 79 69 65 6c 64 20 74 | 6f 20 6f 74 68 65 72 20 | yield t|o other |
|00005b10| 74 68 72 65 61 64 73 2c | 20 61 6e 64 20 79 6f 75 |threads,| and you|
|00005b20| 20 6d 75 73 74 20 6e 6f | 74 20 6d 6f 64 69 66 79 | must no|t modify|
|00005b30| 20 74 68 65 20 43 68 65 | 63 6b 46 6f 72 43 61 6e | the Che|ckForCan|
|00005b40| 63 65 6c 28 29 20 66 75 | 6e 63 74 69 6f 6e 2e 20 |cel() fu|nction. |
|00005b50| 4e 6f 74 65 20 74 68 61 | 74 20 69 74 20 69 73 20 |Note tha|t it is |
|00005b60| 70 6f 73 73 69 62 6c 65 | 20 74 6f 20 63 61 6c 6c |possible| to call|
|00005b70| 20 43 68 65 63 6b 46 6f | 72 43 61 6e 63 65 6c 28 | CheckFo|rCancel(|
|00005b80| 29 20 77 69 74 68 6f 75 | 74 20 79 69 65 6c 64 69 |) withou|t yieldi|
|00005b90| 6e 67 20 74 6f 20 6f 74 | 68 65 72 20 74 68 72 65 |ng to ot|her thre|
|00005ba0| 61 64 73 20 28 73 65 65 | 20 69 74 73 20 64 65 66 |ads (see| its def|
|00005bb0| 69 6e 69 74 69 6f 6e 20 | 69 6e 20 53 65 72 76 69 |inition |in Servi|
|00005bc0| 63 65 2e 63 70 29 2e 0d | 09 41 20 74 68 72 65 61 |ce.cp)..|.A threa|
|00005bd0| 64 65 64 20 73 65 72 76 | 69 63 65 20 6d 61 79 20 |ded serv|ice may |
|00005be0| 73 65 74 20 74 68 65 20 | 73 74 61 74 65 20 6f 66 |set the |state of|
|00005bf0| 20 61 6e 79 20 74 68 72 | 65 61 64 65 64 20 73 65 | any thr|eaded se|
|00005c00| 72 76 69 63 65 20 28 69 | 6e 63 6c 75 64 69 6e 67 |rvice (i|ncluding|
|00005c10| 20 69 74 73 20 6f 77 6e | 29 20 74 6f 20 61 6e 79 | its own|) to any|
|00005c20| 20 73 74 61 74 65 20 74 | 68 65 20 54 68 72 65 61 | state t|he Threa|
|00005c30| 64 20 4d 61 6e 61 67 65 | 72 20 61 6c 6c 6f 77 73 |d Manage|r allows|
|00005c40| 2c 20 69 6e 63 6c 75 64 | 69 6e 67 20 74 68 65 20 |, includ|ing the |
|00005c50| 73 74 6f 70 70 65 64 20 | 73 74 61 74 65 2e 20 41 |stopped |state. A|
|00005c60| 20 6e 6f 6e 2d 74 68 72 | 65 61 64 65 64 20 73 65 | non-thr|eaded se|
|00005c70| 72 76 69 63 65 20 6d 61 | 79 20 73 65 74 20 74 68 |rvice ma|y set th|
|00005c80| 65 20 73 74 61 74 65 20 | 6f 66 20 61 6e 79 20 74 |e state |of any t|
|00005c90| 68 72 65 61 64 65 64 20 | 73 65 72 76 69 63 65 2e |hreaded |service.|
|00005ca0| 20 48 6f 77 65 76 65 72 | 2c 20 63 68 61 6e 67 69 | However|, changi|
|00005cb0| 6e 67 20 74 68 65 20 73 | 74 61 74 65 20 6f 66 20 |ng the s|tate of |
|00005cc0| 61 6e 6f 74 68 65 72 20 | 74 68 72 65 61 64 20 73 |another |thread s|
|00005cd0| 68 6f 75 6c 64 20 6f 6e | 6c 79 20 6f 63 63 75 72 |hould on|ly occur|
|00005ce0| 20 69 66 20 74 68 65 20 | 73 65 72 76 69 63 65 20 | if the |service |
|00005cf0| 65 78 65 63 75 74 69 6e | 67 20 69 6e 20 74 68 61 |executin|g in tha|
|00005d00| 74 20 74 68 72 65 61 64 | 20 69 73 20 70 72 65 70 |t thread| is prep|
|00005d10| 61 72 65 64 20 66 6f 72 | 20 69 74 2e 20 46 6f 72 |ared for| it. For|
|00005d20| 20 65 78 61 6d 70 6c 65 | 2c 20 79 6f 75 20 70 72 | example|, you pr|
|00005d30| 6f 62 61 62 6c 79 20 64 | 6f 20 6e 6f 74 20 77 61 |obably d|o not wa|
|00005d40| 6e 74 20 74 6f 20 73 65 | 74 20 74 68 65 20 73 74 |nt to se|t the st|
|00005d50| 61 74 65 20 6f 66 20 61 | 20 74 68 72 65 61 64 20 |ate of a| thread |
|00005d60| 74 6f 20 73 74 6f 70 70 | 65 64 20 69 66 20 69 74 |to stopp|ed if it|
|00005d70| 20 69 73 20 69 6e 20 74 | 68 65 20 6d 69 64 64 6c | is in t|he middl|
|00005d80| 65 20 6f 66 20 61 20 66 | 69 6c 65 20 63 6f 70 79 |e of a f|ile copy|
|00005d90| 2e 20 49 6e 20 6f 74 68 | 65 72 20 77 6f 72 64 73 |. In oth|er words|
|00005da0| 2c 20 69 66 20 79 6f 75 | 20 64 6f 20 6e 6f 74 20 |, if you| do not |
|00005db0| 74 68 6f 72 6f 75 67 68 | 6c 79 20 75 6e 64 65 72 |thorough|ly under|
|00005dc0| 73 74 61 6e 64 20 61 20 | 74 68 72 65 61 64 65 64 |stand a |threaded|
|00005dd0| 20 73 65 72 76 69 63 65 | 20 79 6f 75 20 73 68 6f | service| you sho|
|00005de0| 75 6c 64 20 6c 65 61 76 | 65 20 69 74 73 20 73 74 |uld leav|e its st|
|00005df0| 61 74 65 20 61 6c 6f 6e | 65 2e 0d 09 43 68 61 6e |ate alon|e...Chan|
|00005e00| 67 69 6e 67 20 74 68 65 | 20 73 74 61 74 65 20 6f |ging the| state o|
|00005e10| 66 20 74 68 65 20 41 70 | 70 6c 69 63 61 74 69 6f |f the Ap|plicatio|
|00005e20| 6e 20 6f 72 20 52 65 71 | 75 65 73 74 44 69 73 70 |n or Req|uestDisp|
|00005e30| 61 74 63 68 65 72 20 74 | 68 72 65 61 64 73 20 69 |atcher t|hreads i|
|00005e40| 73 20 6e 6f 74 20 61 6c | 6c 6f 77 65 64 2c 20 61 |s not al|lowed, a|
|00005e50| 6e 64 20 64 6f 69 6e 67 | 20 73 6f 20 77 6f 75 6c |nd doing| so woul|
|00005e60| 64 20 68 61 76 65 20 61 | 6e 20 75 6e 64 65 66 69 |d have a|n undefi|
|00005e70| 6e 65 64 20 65 66 66 65 | 63 74 20 6f 6e 20 74 68 |ned effe|ct on th|
|00005e80| 65 20 74 68 72 65 61 64 | 65 64 20 6d 6f 64 65 6c |e thread|ed model|
|00005e90| 2e 20 53 69 6e 63 65 20 | 6e 6f 6e 2d 74 68 72 65 |. Since |non-thre|
|00005ea0| 61 64 65 64 20 73 65 72 | 76 69 63 65 73 20 61 72 |aded ser|vices ar|
|00005eb0| 65 20 65 78 65 63 75 74 | 65 64 20 69 6e 20 74 68 |e execut|ed in th|
|00005ec0| 65 20 52 65 71 75 65 73 | 74 44 69 73 70 61 74 63 |e Reques|tDispatc|
|00005ed0| 68 65 72 20 74 68 72 65 | 61 64 2c 20 74 68 65 69 |her thre|ad, thei|
|00005ee0| 72 20 73 74 61 74 65 20 | 69 73 20 61 6c 73 6f 20 |r state |is also |
|00005ef0| 6e 6f 6e 2d 6d 6f 64 69 | 66 69 61 62 6c 65 2e 20 |non-modi|fiable. |
|00005f00| 4f 66 20 63 6f 75 72 73 | 65 2c 20 64 75 72 69 6e |Of cours|e, durin|
|00005f10| 67 20 65 78 65 63 75 74 | 69 6f 6e 20 6f 66 20 61 |g execut|ion of a|
|00005f20| 20 6e 6f 6e 2d 74 68 72 | 65 61 64 65 64 20 73 65 | non-thr|eaded se|
|00005f30| 72 76 69 63 65 20 6e 6f | 20 6f 74 68 65 72 20 73 |rvice no| other s|
|00005f40| 65 72 76 69 63 65 73 20 | 72 65 63 65 69 76 65 20 |ervices |receive |
|00005f50| 61 6e 79 20 74 69 6d 65 | 2c 20 73 6f 20 74 68 69 |any time|, so thi|
|00005f60| 73 20 69 73 20 61 20 6d | 6f 6f 74 20 70 6f 69 6e |s is a m|oot poin|
|00005f70| 74 2e 0d 09 49 66 20 61 | 20 74 68 72 65 61 64 65 |t...If a| threade|
|00005f80| 64 20 73 65 72 76 69 63 | 65 20 69 6e 20 74 68 65 |d servic|e in the|
|00005f90| 20 73 74 6f 70 70 65 64 | 20 73 74 61 74 65 20 69 | stopped| state i|
|00005fa0| 73 20 63 61 6e 63 65 6c | 65 64 2c 20 69 74 73 20 |s cancel|ed, its |
|00005fb0| 74 68 72 65 61 64 20 69 | 73 20 61 75 74 6f 6d 61 |thread i|s automa|
|00005fc0| 74 69 63 61 6c 6c 79 20 | 73 65 74 20 74 6f 20 74 |tically |set to t|
|00005fd0| 68 65 20 72 65 61 64 79 | 20 73 74 61 74 65 20 61 |he ready| state a|
|00005fe0| 6e 64 20 69 74 20 77 69 | 6c 6c 20 62 65 20 67 69 |nd it wi|ll be gi|
|00005ff0| 76 65 6e 20 74 69 6d 65 | 20 74 6f 20 70 65 72 66 |ven time| to perf|
|00006000| 6f 72 6d 20 69 74 73 20 | 63 61 6e 63 65 6c 6c 61 |orm its |cancella|
|00006010| 74 69 6f 6e 20 63 6c 65 | 61 6e 75 70 2e 20 41 20 |tion cle|anup. A |
|00006020| 74 68 72 65 61 64 65 64 | 20 73 65 72 76 69 63 65 |threaded| service|
|00006030| 20 69 73 20 6e 6f 74 20 | 63 6f 6e 73 69 64 65 72 | is not |consider|
|00006040| 65 64 20 66 75 6c 6c 79 | 20 63 61 6e 63 65 6c 65 |ed fully| cancele|
|00006050| 64 20 75 6e 74 69 6c 20 | 69 74 73 20 52 65 71 75 |d until |its Requ|
|00006060| 65 73 74 20 6f 62 6a 65 | 63 74 20 69 73 20 72 65 |est obje|ct is re|
|00006070| 6d 6f 76 65 64 20 66 72 | 6f 6d 20 74 68 65 20 61 |moved fr|om the a|
|00006080| 63 74 69 76 65 20 72 65 | 71 75 65 73 74 20 6c 69 |ctive re|quest li|
|00006090| 73 74 2e 20 54 68 69 73 | 20 6d 65 61 6e 73 20 74 |st. This| means t|
|000060a0| 68 65 20 63 75 73 74 6f | 6d 20 73 65 72 76 69 63 |he custo|m servic|
|000060b0| 65 20 66 75 6e 63 74 69 | 6f 6e 20 74 72 79 69 6e |e functi|on tryin|
|000060c0| 67 20 74 6f 20 63 6c 65 | 61 6e 20 75 70 20 61 66 |g to cle|an up af|
|000060d0| 74 65 72 20 61 20 63 61 | 6e 63 65 6c 20 63 61 6e |ter a ca|ncel can|
|000060e0| 20 79 69 65 6c 64 20 74 | 6f 20 6f 74 68 65 72 20 | yield t|o other |
|000060f0| 74 68 72 65 61 64 73 20 | 6f 6e 63 65 20 6f 72 20 |threads |once or |
|00006100| 6d 75 6c 74 69 70 6c 65 | 20 74 69 6d 65 73 2c 20 |multiple| times, |
|00006110| 69 66 20 6e 65 63 65 73 | 73 61 72 79 2c 20 62 65 |if neces|sary, be|
|00006120| 66 6f 72 65 20 72 65 74 | 75 72 6e 69 6e 67 2e 20 |fore ret|urning. |
|00006130| 49 74 20 77 69 6c 6c 20 | 63 6f 6e 74 69 6e 75 65 |It will |continue|
|00006140| 20 74 6f 20 72 65 63 65 | 69 76 65 20 74 69 6d 65 | to rece|ive time|
|00006150| 20 77 68 69 6c 65 20 69 | 74 20 73 74 69 6c 6c 20 | while i|t still |
|00006160| 65 78 69 73 74 73 2e 20 | 49 6e 20 70 72 61 63 74 |exists. |In pract|
|00006170| 69 63 65 2c 20 6f 6e 63 | 65 20 43 68 65 63 6b 46 |ice, onc|e CheckF|
|00006180| 6f 72 43 61 6e 63 65 6c | 28 29 20 72 65 74 75 72 |orCancel|() retur|
|00006190| 6e 73 20 74 72 75 65 2c | 20 6d 6f 73 74 20 73 65 |ns true,| most se|
|000061a0| 72 76 69 63 65 73 20 64 | 6f 20 6e 6f 74 20 79 69 |rvices d|o not yi|
|000061b0| 65 6c 64 3b 20 74 68 65 | 79 20 6a 75 73 74 20 63 |eld; the|y just c|
|000061c0| 6c 65 61 6e 20 75 70 20 | 61 6e 64 20 72 65 74 75 |lean up |and retu|
|000061d0| 72 6e 2e 0d 41 70 70 6c | 69 63 61 74 69 6f 6e 20 |rn..Appl|ication |
|000061e0| 54 68 72 65 61 64 0d 09 | 54 68 65 20 41 70 70 6c |Thread..|The Appl|
|000061f0| 69 63 61 74 69 6f 6e 20 | 74 68 72 65 61 64 20 69 |ication |thread i|
|00006200| 73 20 74 68 65 20 6d 61 | 69 6e 28 29 20 74 68 72 |s the ma|in() thr|
|00006210| 65 61 64 20 74 68 61 74 | 20 69 73 20 63 72 65 61 |ead that| is crea|
|00006220| 74 65 64 20 62 79 20 74 | 68 65 20 54 68 72 65 61 |ted by t|he Threa|
|00006230| 64 20 4d 61 6e 61 67 65 | 72 20 66 6f 72 20 65 76 |d Manage|r for ev|
|00006240| 65 72 79 20 61 70 70 6c | 69 63 61 74 69 6f 6e 2c |ery appl|ication,|
|00006250| 20 77 68 65 74 68 65 72 | 20 69 74 20 69 73 20 61 | whether| it is a|
|00006260| 77 61 72 65 20 6f 66 20 | 74 68 72 65 61 64 73 20 |ware of |threads |
|00006270| 6f 72 20 6e 6f 74 2e 20 | 41 6c 74 68 6f 75 67 68 |or not. |Although|
|00006280| 20 74 68 65 20 54 68 72 | 65 61 64 20 4d 61 6e 61 | the Thr|ead Mana|
|00006290| 67 65 72 20 61 6c 6c 6f | 77 73 20 61 6e 79 20 54 |ger allo|ws any T|
|000062a0| 6f 6f 6c 62 6f 78 20 63 | 61 6c 6c 20 66 72 6f 6d |oolbox c|all from|
|000062b0| 20 61 6e 79 20 74 68 72 | 65 61 64 2c 20 69 6e 20 | any thr|ead, in |
|000062c0| 74 68 69 73 20 69 6d 70 | 6c 65 6d 65 6e 74 61 74 |this imp|lementat|
|000062d0| 69 6f 6e 20 74 68 65 20 | 41 70 70 6c 69 63 61 74 |ion the |Applicat|
|000062e0| 69 6f 6e 20 74 68 72 65 | 61 64 20 69 73 20 74 68 |ion thre|ad is th|
|000062f0| 65 20 6f 6e 6c 79 20 74 | 68 72 65 61 64 20 69 6e |e only t|hread in|
|00006300| 20 77 68 69 63 68 20 74 | 68 65 20 45 76 65 6e 74 | which t|he Event|
|00006310| 20 4d 61 6e 61 67 65 72 | 20 69 73 20 63 61 6c 6c | Manager| is call|
|00006320| 65 64 2e 20 57 68 65 6e | 20 61 6e 79 20 74 68 72 |ed. When| any thr|
|00006330| 65 61 64 20 63 61 6c 6c | 73 20 59 69 65 6c 64 54 |ead call|s YieldT|
|00006340| 6f 41 6e 79 54 68 72 65 | 61 64 28 29 2c 20 61 6e |oAnyThre|ad(), an|
|00006350| 64 20 74 68 65 72 65 20 | 69 73 20 61 6e 20 65 76 |d there |is an ev|
|00006360| 65 6e 74 20 69 6e 20 74 | 68 65 20 61 70 70 6c 69 |ent in t|he appli|
|00006370| 63 61 74 69 6f 6e 27 73 | 20 65 76 65 6e 74 20 71 |cation's| event q|
|00006380| 75 65 75 65 2c 20 74 68 | 65 20 54 68 72 65 61 64 |ueue, th|e Thread|
|00006390| 20 4d 61 6e 61 67 65 72 | 20 64 65 66 61 75 6c 74 | Manager| default|
|000063a0| 20 73 63 68 65 64 75 6c | 65 72 20 6a 75 6d 70 73 | schedul|er jumps|
|000063b0| 20 6f 75 74 20 6f 66 20 | 6f 72 64 65 72 20 74 6f | out of |order to|
|000063c0| 20 74 68 65 20 41 70 70 | 6c 69 63 61 74 69 6f 6e | the App|lication|
|000063d0| 20 74 68 72 65 61 64 2e | 20 54 68 69 73 20 70 72 | thread.| This pr|
|000063e0| 6f 76 69 64 65 73 20 6d | 61 78 69 6d 75 6d 20 70 |ovides m|aximum p|
|000063f0| 65 72 66 6f 72 6d 61 6e | 63 65 20 66 6f 72 20 74 |erforman|ce for t|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.